min method

AsObservableFuture<T> min(
  1. [Comparator<T> comparator]

Converts a Stream into a Future that completes with the smallest item emitted by the Stream.

This is similar to finding the min value in a list, but the values are asynchronous!


final min = await new Observable.fromIterable([1, 2, 3]).min();

print(min); // prints 1

Example with custom Comparator

final observable = new Observable.fromIterable(["short", "looooooong"]);
final min = await observable.min((a, b) => a.length - b.length);

print(min); // prints "short"


AsObservableFuture<T> min([Comparator<T> comparator]) =>
    AsObservableFuture<T>(StreamMinFuture<T>(_stream, comparator));