bind method
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.
Implementation
Stream<T> bind(Stream<S> stream) {
return new Stream<T>.eventTransformed(
stream, (EventSink sink) => new _ConverterStreamEventSink(this, sink));
}