StreamSource<T> class final

Owns one source subscription, without adding a controller or a queue.

Start, pause and teardown share the same discipline in relays and bounded buffers. Cancelling attempts source cleanup but never awaits user work.

Constructors

StreamSource({required Stream<T> source(), required void onData(T), required void onError(Object, StackTrace), required void onDone(), void onCancelFailed(Object, StackTrace)?, bool pauseBroadcast = true})
Defers source until start. A cancelled source is never started.
StreamSource.fromStream(Stream<T> stream, {required void onData(T), required void onError(Object, StackTrace), required void onDone(), void onCancelFailed(Object, StackTrace)?, bool pauseBroadcast = true})
Owns an existing stream without retaining it after subscription starts.

Properties

hashCode → int
The hash code for this object.
no setterinherited
isClosed → bool
Whether this owner has released the source and its callback captures.
no setter
pauseBroadcast → bool
Whether pausing should pause a broadcast subscription too. A bounded buffer instead keeps receiving broadcasts into its own queue.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancel() → void
Releases all owned references and attempts cancellation once.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → void
Pauses demand. A pause requested during listen is applied afterwards.
resume() → void
Resumes demand after a matching pause.
start() → void
Invokes the factory and listens once. Factory/listen failures are events.
toString() → String
A string representation of this object.
inherited

Operators

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