W3cubDocs

/Dart 2

StreamTransformer<S, T>.fromBind constructor

  1. @Since("2.1")
StreamTransformer<S, T>.fromBind(Stream<T> bind(Stream<S>))

Creates a StreamTransformer based on a bind callback.

The returned stream transformer uses the bind argument to implement the StreamTransformer.bind API and can be used when the transformation is available as a stream-to-stream function.

final splitDecoded = StreamTransformer<List<int>, String>.fromBind(
    (stream) => stream.transform(utf8.decoder).transform(LineSplitter()));

Implementation

@Since("2.1")
factory StreamTransformer.fromBind(Stream<T> Function(Stream<S>) bind) =
    _StreamBindTransformer<S, T>;

© 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/StreamTransformer/StreamTransformer.fromBind.html