min property
- @useResult
The minimum element in this iterable or null
if empty. Returns double.nan if present.
[1, 2, 3].min; // 1
[1, 2, double.nan]; // double.nan
Implementation
@useResult E? get min {
final iterator = this.iterator;
if (!iterator.moveNext()) {
return null;
}
var min = iterator.current;
if (min.isNaN) {
return min;
}
while (iterator.moveNext()) {
final element = iterator.current;
if (element.isNaN) {
return element;
}
if (min.compareTo(element) > 0) {
min = element;
}
}
return min;
}