PollingStreamService<TData extends Object> class
abstract
Convenience base class for PollingStreamServiceMixin. Use this if you don't need to extend another class.
- Mixed-in types
-
- ServiceMixin
- StreamServiceMixin<
TData> - PollingStreamServiceMixin<
TData>
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 - 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
-
dispose(
{bool eagerError = false}) → Resolvable< Unit> -
Drives the service into ServiceState.DISPOSE_SUCCESS by running
listeners from provideDisposeListeners.
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).inherited -
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.inherited -
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 -
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
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited