Observable<T>.switchLatest constructor
Convert a Stream that emits Streams (aka a "Higher Order Stream") into a single Observable that emits the items emitted by the most-recently-emitted of those Streams.
This Observable will unsubscribe from the previously-emitted Stream when a new Stream is emitted from the source Stream and subscribe to the new Stream.
Example
final switchLatestStream = new SwitchLatestStream<String>(
new Stream.fromIterable(<Stream<String>>[
new Observable.timer('A', new Duration(seconds: 2)),
new Observable.timer('B', new Duration(seconds: 1)),
new Observable.just('C'),
]),
);
// Since the first two Streams do not emit data for 1-2 seconds, and the
// 3rd Stream will be emitted before that time, only data from the 3rd
// Stream will be emitted to the listener.
switchLatestStream.listen(print); // prints 'C'
Implementation
factory Observable.switchLatest(Stream<Stream<T>> streams) =>
Observable<T>(SwitchLatestStream<T>(streams));