pipe method
- StreamConsumer<
T> streamConsumer
Pipes the events of this stream intostreamConsumer.
All events of this stream are added tostreamConsumer usingStreamConsumer.addStream.ThestreamConsumer is closed when this stream has been successfully addedto it - when the future returned byaddStream completes without an error.
Returns a future which completes when this stream has been consumedand the consumer has been closed.
The returned future completes with the same result as the future returnedbyStreamConsumer.close.If the call toStreamConsumer.addStream fails in some way, thismethod fails in the same way.
Implementation
Future pipe(StreamConsumer<T> streamConsumer) { return streamConsumer.addStream(this).then((_) => streamConsumer.close());}