dematerialize<S> method

Observable<S> dematerialize <S>()

Converts the onData, onDone, and onError Notification 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 Notification objects. Dematerialize simply reverses this by transforming Notification objects back to a normal stream of events.

Example

new Observable<Notification<int>>
    .fromIterable([new Notification.onData(1), new Notification.onDone()])
    .dematerialize()
    .listen((i) => print(i)); // Prints 1

Error example

new Observable<Notification<int>>
    .just(new Notification.onError(new Exception(), null))
    .dematerialize()
    .listen(null, onError: (e, s) { print(e) }); // Prints Exception

Implementation

Observable<S> dematerialize<S>() {
  return cast<Notification<S>>()
      .transform(new DematerializeStreamTransformer<S>());
}