FlutterTimezoneObserverWeb class

A web implementation of FlutterTimezoneObserverPlatform.

The IANA timezone name is read from the browser via Intl.DateTimeFormat().resolvedOptions().timeZone.


Note: browsers do not broadcast a "timezone changed" event, so changes cannot be observed the way they are on Android and iOS. Instead, this implementation detects them by re-reading the browser value:

  1. Every 5 seconds while the page is visible.
  2. Immediately when the page becomes visible again or the window regains focus — the usual path when the user changes the timezone in the OS settings and switches back to the browser.

Polling is suspended while the page is hidden, since browsers throttle timers in background tabs anyway.

Inheritance

Constructors

FlutterTimezoneObserverWeb({Duration pollInterval = _defaultPollInterval, String timezoneReader()?})
Creates a web implementation of FlutterTimezoneObserverPlatform.

Properties

currentTimezone Future<String>
Fetches the current IANA timezone name from the browser.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
onTimezoneChanged Stream<String>
A Stream that emits the new IANA timezone name whenever the browser reports a different one.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

registerWith(Registrar registrar) → void
Registers this class as the default instance of FlutterTimezoneObserverPlatform.