min method
T
min()
Returns the minimum value in the iterable.
Throws a StateError if the iterable is empty.
Example:
[1, 5, 3].min(); // 1
Implementation
T min() {
if (isEmpty) {
throw StateError('Cannot get min of an empty iterable');
}
return reduce((a, b) => a < b ? a : b);
}