Invokes the given callback at the corresponding point the the stream lifecycle. For example, if you pass in an onDone callback, it will be invoked when the stream finishes emitting items.
This transformer can be used for debugging, logging, etc. by intercepting the stream at different points to run arbitrary actions.
It is possible to hook onto the following parts of the stream lifecycle:
In addition, the
onEach argument is called at
onError with a Notification passed in. The Notification argument
contains the Kind of event (OnData, OnDone, OnError), and the item or
error that was emitted. In the case of onDone, no data is emitted as part
of the Notification.
If no callbacks are passed in, a runtime error will be thrown in dev mode in order to "fail fast" and alert the developer that the transformer should be used or safely removed.
new Stream.fromIterable() .transform(new DoStreamTransformer( onData: print, onError: (e, s) => print("Oh no!"), onDone: () => print("Done"))) .listen(null); // Prints: 1, "Done"
- hashCode → int
The hash code for this object.
- runtimeType → Type
A representation of the runtime type of the object.
Stream< T>stream) → Stream< T>
Transforms the provided
RS, RT>( ) → StreamTransformer< RS, RT>
StreamTransformer<RS, RT>view of this stream transformer.inherited
Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
) → String
Returns a string representation of this object.
dynamic other) → bool
The equality operator.