min method

AsObservableFuture<T> min ([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!

Example

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"

Implementation

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