maxOrNull property
num?
get
maxOrNull
A maximal element of the iterable, or null
if the iterable is empty.
If any element is NaN, the result is NaN.
Implementation
num? get maxOrNull {
var iterator = this.iterator;
if (iterator.moveNext()) {
var value = iterator.current;
if (value.isNaN) {
return value;
}
while (iterator.moveNext()) {
var newValue = iterator.current;
if (newValue.isNaN) {
return newValue;
}
if (newValue > value) {
value = newValue;
}
}
return value;
}
return null;
}