- 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, and any previously created Stream will stop emitting.
The switchMap operator is similar to the flatMap and concatMap methods, but it only emits items from the most recently created Stream.
This can be useful when you only want the very latest state from asynchronous APIs, for example.
Observable.range(4, 1) .switchMap((i) => new Observable.timer(i, new Duration(minutes: i)) .listen(print); // prints 1
Observable<S> switchMap<S>(Stream<S> mapper(T value)) => transform(SwitchMapStreamTransformer<T, S>(mapper));