flatMap<S> method

Observable<S> flatMap <S>(Stream<S> mapper(T value))

Converts each emitted item into a new Stream using the given mapper function. The newly created Stream will be be listened to and begin emitting items downstream.

The items emitted by each of the new Streams are emitted downstream in the same order they arrive. In other words, the sequences are merged together.

Example

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

Implementation

Observable<S> flatMap<S>(Stream<S> mapper(T value)) =>
    transform(new FlatMapStreamTransformer<T, S>(mapper));