StreamSubscription<T> class

A subscritption on events from a Stream.

A subscritption on events from a Stream.

When you listen on a Stream using Stream.listen, a StreamSubscription object is returned.

The subscription provides events to the listener, and holds the callbacks used to handle the events. The subscription can also be used to unsubscribe from the events, or to temporarily pause the events from the stream.

Constructors

StreamSubscription()

Instance Properties

isPaused bool
read-only

Instance Methods

cancel() → Future
Cancels this subscription. It will no longer receive events.
onData(void handleData(T data)) → void
Set or override the data event handler of this subscription.
onError(Function handleError) → void
Set or override the error event handler of this subscription.
onDone(void handleDone()) → void
Set or override the done event handler of this subscription.
pause([Future resumeSignal]) → void
Request that the stream pauses events until further notice.
resume() → void
Resume after a pause.
asFuture([futureValue]) → Future
Returns a future that handles the onDone and onError callbacks.