ObservedPollingStreamService<TData extends Object> class
abstract
An ObservedService that polls an external source on a fixed interval (via PollingStreamServiceMixin) and exposes it as a broadcast stream.
- Inheritance
-
- Object
- WidgetsBindingObserver
- ObservedService
- ObservedPollingStreamService
- Mixed-in types
-
- StreamServiceMixin<
TData> - PollingStreamServiceMixin<
TData>
- StreamServiceMixin<
Constructors
Properties
- didEverInitAndSuccessfully → bool
-
trueonce init has completed successfully at least once for this service instance. Staystrueeven after a subsequent error or dispose.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
-
initialData
→ Option<
Resolvable< TData> > -
Resolves with the first data point emitted on the stream after init.
Becomes
Some(Err)if the stream is stopped before any data arrives, so callers don't hang forever.no setterinherited - isObserverRegistered → bool
-
Whether this service is currently registered as a
WidgetsBindingObserver. Becomes
trueafter registerObserver runs successfully andfalseafter unregisterObserver.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → ServiceState
-
The current state of the service.
no setterinherited
-
stream
→ Option<
Stream< Result< >TData> > -
The broadcast stream of Result<TData> events.
Nonebefore init and after dispose; otherwise wraps a broadcast controller's stream.no setterinherited
Methods
-
didChangeAccessibilityFeatures(
) → void -
Called when the system changes the set of currently active accessibility
features.
inherited
-
didChangeAppLifecycleState(
AppLifecycleState state) → void -
Called when the system puts the app in the background or returns
the app to the foreground.
inherited
-
didChangeLocales(
List< Locale> ? locales) → void -
Called when the system tells the app that the user's locale has
changed. For example, if the user changes the system language
settings.
inherited
-
didChangeMetrics(
) → void -
Called when the application's dimensions change. For example,
when a phone is rotated.
inherited
-
didChangePlatformBrightness(
) → void -
Called when the platform brightness changes.
inherited
-
didChangeTextScaleFactor(
) → void -
Called when the platform's text scale factor changes.
inherited
-
didChangeViewFocus(
ViewFocusEvent event) → void -
Called whenever the PlatformDispatcher receives a notification that the
focus state on a view has changed.
inherited
-
didHaveMemoryPressure(
) → void -
Called when the system is running low on memory.
inherited
-
didPopRoute(
) → Future< bool> -
Called when the system tells the app to pop the current route, such as
after a system back button press or back gesture.
inherited
-
didPushRoute(
String route) → Future< bool> -
Called when the host tells the application to push a new route onto the
navigator.
inherited
-
didPushRouteInformation(
RouteInformation routeInformation) → Future< bool> -
Called when the host tells the application to push a new
RouteInformation and a restoration state onto the router.
inherited
-
didRequestAppExit(
) → Future< AppExitResponse> -
Called when a request is received from the system to exit the application.
inherited
-
dispose(
{bool eagerError = false}) → Resolvable< Unit> -
Drives the service into ServiceState.DISPOSE_SUCCESS by running
listeners from provideDisposeListeners.
inherited
-
handleCancelBackGesture(
) → void -
Called when a predictive back gesture is canceled, indicating that no
navigation should occur.
inherited
-
handleCommitBackGesture(
) → void -
Called when a predictive back gesture is finished successfully, indicating
that the current route should be popped.
inherited
-
handleDetachedState(
) → bool -
Return
trueto have the service dispose when the app enters AppLifecycleState.detached. Defaults tofalse(opt-in).inherited -
handleHiddenState(
) → bool -
Return
trueto have the service pause when the app enters AppLifecycleState.hidden. Defaults tofalse(opt-in).inherited -
handleInactiveState(
) → bool -
Return
trueto have the service pause when the app enters AppLifecycleState.inactive. Defaults tofalse(opt-in).inherited -
handlePausedState(
) → bool -
Return
trueto have the service pause when the app enters AppLifecycleState.paused. Defaults tofalse(opt-in).inherited -
handleResumedState(
) → bool -
Return
trueto have the service resume when the app enters AppLifecycleState.resumed. Defaults tofalse(opt-in).inherited -
handleStartBackGesture(
PredictiveBackEvent backEvent) → bool -
Called at the start of a predictive back gesture.
inherited
-
handleStatusBarTap(
) → void -
Called when the user taps the status bar on iOS, to scroll a scroll
view to the top.
inherited
-
handleUpdateBackGestureProgress(
PredictiveBackEvent backEvent) → void -
Called when a predictive back gesture moves.
inherited
-
init(
{bool eagerError = true}) → Resolvable< Unit> -
Drives the service from ServiceState.NOT_INITIALIZED to
ServiceState.RUN_SUCCESS by running every listener from
provideInitListeners sequentially.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onPoll(
) → Resolvable< TData> -
Subclasses implement the actual polling call (fetch / read / refresh).
Invoked once on subscription and then every providePollingInterval.
inherited
-
pause(
{bool eagerError = false}) → Resolvable< Unit> -
Transitions the service into ServiceState.PAUSE_SUCCESS by running
listeners from providePauseListeners.
inherited
-
provideDisposeListeners(
void _) → TServiceResolvables< Unit> -
Subclasses return the listeners to run when dispose is called. Mixins
must call
super.provideDisposeListeners(null)and prepend/append their own listeners (typically prepending teardown ahead ofsuper's base cleanup).override -
provideInitListeners(
void _) → TServiceResolvables< Unit> -
Subclasses return the listeners to run when init is called. Mixins
must call
super.provideInitListeners(null)and prepend/append their own listeners.override -
provideInputStream(
) → TResultStream< TData> -
Subclasses return the upstream input that feeds this service. Called
once per
restartStream/init. May return a single-subscription or broadcast stream.inherited -
provideOnPushToStreamListeners(
) → TServiceResolvables< Result< TData> > -
Subclasses return per-emission listeners that observe every value
pushed via pushToStream (in arrival order). Mixins must call
super.provideOnPushToStreamListeners()and prepend/append their own listeners.inherited -
providePauseListeners(
void _) → TServiceResolvables< Unit> -
Subclasses return the listeners to run when pause is called. Mixins
must call
super.providePauseListeners(null)and prepend/append their own listeners.inherited -
providePollingInterval(
) → Duration -
Subclasses return the interval between consecutive onPoll invocations.
The first poll fires immediately on subscription; subsequent polls fire
every
providePollingInterval()thereafter.inherited -
provideResumeListeners(
void _) → TServiceResolvables< Unit> -
Subclasses return the listeners to run when resume is called. Mixins
must call
super.provideResumeListeners(null)and prepend/append their own listeners.inherited -
pushToStream(
Result< TData> data, {bool eagerError = false}) → Resolvable<Option< Object> > -
Forwards a
dataevent into the broadcast controller and runs every listener from provideOnPushToStreamListeners in arrival order via the single per-service_pushSequencer(so emissions never interleave with each other's listener chains).inherited -
registerObserver(
) → Resolvable< Unit> -
Adds this service as a global WidgetsBindingObserver. Idempotent —
safe to call multiple times within a single lifetime.
inherited
-
restartStream(
) → Resolvable< Unit> -
Tears down the current stream and immediately starts a fresh one.
Increments the internal epoch so in-flight pushes from the old stream
are dropped instead of landing in the new controller/completer.
inherited
-
resume(
{bool eagerError = false}) → Resolvable< Unit> -
Transitions the service into ServiceState.RESUME_SUCCESS by running
listeners from provideResumeListeners.
inherited
-
stopStream(
) → Resolvable< Unit> -
Cancels the current input subscription, closes the broadcast controller,
and resolves initialData with an Err (so awaiters don't hang forever).
Safe to call repeatedly: subsequent calls become no-ops.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unregisterObserver(
) → Resolvable< Unit> -
Removes this service as a global WidgetsBindingObserver. Idempotent —
safe to call multiple times.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited