materialize method

Stream<StreamNotification<T>> materialize()

Converts the onData, on Done, and onError events into StreamNotification objects that are passed into the downstream onData listener.

The StreamNotification object contains the NotificationKind of event (OnData, onDone, or OnError), and the item or error that was emitted. In the case of onDone, no data is emitted as part of the StreamNotification.

Example: Stream

Stream<int>.error(Exception())
    .materialize()
    .listen(print); // Prints ErrorNotification{error: Exception, stackTrace: }, DoneNotification{}

Implementation

Stream<StreamNotification<T>> materialize() =>
    MaterializeStreamTransformer<T>().bind(this);