StreamTransformer abstract class

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.map, 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

Constructors

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

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) })
factory

Creates a StreamTransformer that delegates events to the given functions.

Properties

hashCodeint
read-only, inherited

The hash code for this object.

runtimeTypeType
read-only, inherited

A representation of the runtime type of the object.

Operators

operator ==(other) → bool
inherited

The equality operator.

Methods

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

Transforms the provided stream.

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.

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-async/StreamTransformer-class.html