StreamExtension<T> extension

A StreamExtension is an extension for Stream with various useful methods.

on

Methods

asCancelable(CancellationToken token, {bool blockOnCancel = true, PauseToken? pauseToken, Duration? timeout}) Stream<T>

Available on Stream<T>, provided by the StreamExtension extension

Returns a stream that allows to cancel a subscription using a cancellation token or a specified timeout, with support for non-blocking cancellation, and with support for sending a request to pause a stream and resume after a pause using a pause token.
asPausable(PauseToken token) Stream<T>

Available on Stream<T>, provided by the StreamExtension extension

Returns a stream that allows to pause/resume a stream subscription using a PauseToken.
handleTermination(void onTerminate()?, {void onCancel()?, void onDone()?, void onError(Object error, StackTrace stackTrace)?}) Stream<T>

Available on Stream<T>, provided by the StreamExtension extension

Returns a stream that allows to define the termination handler onTerminate and the status handlers onCancel, onDone and onError.