asyncExpand<S> method

  1. @override
Observable<S> asyncExpand <S>(Stream<S> mapper(T value))

Maps each emitted item to a new Stream using the given mapper, then subscribes to each new stream one after the next until all values are emitted.

asyncExpand is similar to flatMap, but ensures order by guaranteeing that all items from the created stream will be emitted before moving to the next created stream. This process continues until all created streams have completed.

This is functionally equivalent to concatMap, which exists as an alias for a more fluent Rx API.

Example

Observable.range(4, 1)
  .asyncExpand((i) =>
    new Observable.timer(i, new Duration(minutes: i))
  .listen(print); // prints 4, 3, 2, 1

Implementation

@override
Observable<S> asyncExpand<S>(Stream<S> mapper(T value)) =>
    Observable<S>(_stream.asyncExpand(mapper));