Transforms a Stream.

When a stream's Stream.transform method is invoked with a StreamTransformer, the stream calls the bind method on the provided transformer. The resulting stream is then returned from the Stream.transform method.

Conceptually, a transformer is simply a function from Stream to Stream that is encapsulated into a class.

It is good practice to write transformers that can be used multiple times.

All other transforming methods on Stream, such as, Stream.where or Stream.expand can be implemented using Stream.transform. A StreamTransformer is thus very powerful but often also a bit more complicated to use.

Implemented by


StreamTransformer(StreamSubscription<T> onListen(Stream<S> stream, bool cancelOnError))

Creates a StreamTransformer based on the given onListen callback.

StreamTransformer.fromHandlers({void handleData(S data, EventSink<T> sink), void handleError(Object error, StackTrace stackTrace, EventSink<T> sink), void handleDone(EventSink<T> sink) })

Creates a StreamTransformer that delegates events to the given functions.



hashCode int

The hash code for this object.

read-only, inherited
runtimeType Type

A representation of the runtime type of the object.

read-only, inherited


operator ==(other) bool

The equality operator.



bind(Stream<S> stream) Stream<T>

Transforms the provided stream.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

toString() String

Returns a string representation of this object.