SettableTimeZone constructor

SettableTimeZone([
  1. TimeFunction timeFunc = systemTime,
  2. bool throwIfNotInitialized = false
])

Accepts a custom timeFunc for testing purposes, following the same pattern as Clock.

throwIfNotInitialized will cause StateError to be thrown if now() is called before offsetFromUtc is set. This will eventually be the only available behavior.

Implementation

// TODO(google): Default throwIfNotInitialized to true. Deprecate+remove it.
SettableTimeZone(
    [TimeFunction timeFunc = systemTime, bool throwIfNotInitialized = false])
    : _time = timeFunc,
      _throwIfNotInitialized = throwIfNotInitialized;