Observable<T>.race constructor

Observable<T>.race(Iterable<Stream<T>> streams)

Given two or more source streams, emit all of the items from only the first of these streams to emit an item or notification.

Interactive marble diagram


new Observable.race([
  new Observable.timer(1, new Duration(days: 1)),
  new Observable.timer(2, new Duration(days: 2)),
  new Observable.timer(3, new Duration(seconds: 1))
]).listen(print); // prints 3


factory Observable.race(Iterable<Stream<T>> streams) =>
    new Observable<T>(new RaceStream<T>(streams));