W3cubDocs

/Dart 2

transform<S> method

Stream<S> transform <S>(StreamTransformer<T, S> streamTransformer)

Applies a StreamTransformer to the current stream.

Returns the result of the stream transformation, that is, the result of streamTransformer.bind(this). This method simply allows writing the call to streamTransformer.bind in a chained fashion, like

stream.map(mapping).transform(transformation).toList()

which can be more convenient than calling bind directly.

The streamTransformer can return any stream. Whether the returned stream is a broadcast stream or not, and which elements it will contain, is entirely up to the transformation.

Implementation

Stream<S> transform<S>(StreamTransformer<T, S> streamTransformer) {
  return streamTransformer.bind(this);
}

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