flatMap<S> method

Observable<S> flatMap<S>(
  1. Stream<S> mapper(
    1. 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.


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


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