min<T> function
Returns the minimum value in i
, according to the order specified by the
compare
function, or null
if i
is empty.
The compare function must act as a Comparator. If compare
is omitted,
Comparable.compare is used. If i
contains null elements, an exception
will be thrown.
Implementation
T? min<T>(Iterable<T> i, [Comparator<T>? compare]) {
if (i.isEmpty) return null;
final Comparator<T> compare0 = compare ?? _compareAny;
return i.reduce((a, b) => compare0(a, b) < 0 ? a : b);
}