dematerialize method

Stream<T> dematerialize()

Converts the onData, onDone, and onError StreamNotification objects from a materialized stream into normal onData, onDone, and onError events.

When a stream has been materialized, it emits onData, onDone, and onError events as StreamNotification objects. Dematerialize simply reverses this by transforming StreamNotification objects back to a normal stream of events.

Example

Stream<StreamNotification<int>>
    .fromIterable([StreamNotification.data(1), StreamNotification.done()])
    .dematerialize()
    .listen(print); // Prints 1

Error example

Stream<StreamNotification<int>>
    .fromIterable([StreamNotification.error(Exception(), null)])
    .dematerialize()
    .listen(null, onError: (e, s) => print(e)); // Prints Exception

Implementation

Stream<T> dematerialize() => DematerializeStreamTransformer<T>().bind(this);