W3cubDocs

/Dart 2

StreamSubscription<T> class

A subscription 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()

Properties

isPausedbool
read-only
Whether the StreamSubscription is currently paused. [...]
hashCodeint
read-only, inherited
The hash code for this object. [...]
runtimeTypeType
read-only, inherited
A representation of the runtime type of the object.

Methods

asFuture<E>([E futureValue ]) → Future<E>
Returns a future that handles the onDone and onError callbacks. [...]
cancel() → Future
Cancels this subscription. [...]
onData(void handleData(T data)) → void
Replaces the data event handler of this subscription. [...]
onDone(void handleDone()) → void
Replaces the done event handler of this subscription. [...]
onError(Function handleError) → void
Replaces the error event handler of this subscription. [...]
pause([Future resumeSignal ]) → void
Request that the stream pauses events until further notice. [...]
resume() → void
Resume after a pause. [...]
noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed. [...]
toString() → String
inherited
Returns a string representation of this object.

Operators

operator ==(dynamic other) → bool
inherited
The equality operator. [...]

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-async/StreamSubscription-class.html