StreamServiceMixin<TData extends Object> mixin
Adds a managed broadcast stream to a ServiceMixin. Subclasses provide an input stream via provideInputStream; the mixin wires it through a broadcast controller, exposes it via stream, and forwards every emission through pushToStream (which runs provideOnPushToStreamListeners in arrival order via a single per-service sequencer).
- Superclass constraints
- Mixin applications
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 setter - 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 setter
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
-
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(
) → Stream< Result< TData> > -
Subclasses return the upstream input that feeds this service. Called
once per
restartStream/init. May return a single-subscription or broadcast stream. -
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. -
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.override -
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.override -
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). -
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.
-
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.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited