materialize method

Stream<Notification<T>> materialize ()

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

The Notification object contains the Kind 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 Notification.

Example: Stream.fromIterable(1) .materialize() .listen((i) => print(i)); // Prints onData & onDone Notification

Stream<int>.error(Exception())
    .materialize()
    .listen((i) => print(i)); // Prints onError Notification

Implementation

Stream<Notification<T>> materialize() =>
    transform(MaterializeStreamTransformer<T>());