race<T> function

Observable<T> race<T>(
  1. Iterable<Observable<T>> sources
)

Creates an Observable that mirrors the first source to emit an item.

Implementation

Observable<T> race<T>(Iterable<Observable<T>> sources) {
  final observables = sources.toList(growable: false);
  return observables.isEmpty
      ? empty()
      : observables.length == 1
          ? observables.first
          : RaceObservable<T>(observables);
}