Stream bind(Stream<String> stream)

Transforms the provided stream.

Returns a new stream with events that are computed from events of the provided stream.

Implementors of the StreamTransformer interface should document differences from the following expected behavior:

  • When the returned stream is listened to, it starts listening to the input stream.
  • Subscriptions of the returned stream forward (in a reasonable time) a StreamSubscription.pause call to the subscription of the input stream.
  • Similarly, canceling a subscription of the returned stream eventually (in reasonable time) cancels the subscription of the input stream.

"Reasonable time" depends on the transformer and stream. Some transformers, like a "timeout" transformer, might make these operations depend on a duration. Others might not delay them at all, or just by a microtask.

Source

Stream/*<String>*/ bind(Stream<String> stream) {
  return new Stream<String>.eventTransformed(
      stream, (EventSink<String> sink) => new _LineSplitterEventSink(sink));
}