maxOrNull method
- return the maximum value in the list
- return
null
if isEmpty
Implementation
num? maxOrNull() {
if (isEmpty) return null;
num max = first;
for (final n in this) {
if (n > max) max = n;
}
return max;
}
null
if isEmptynum? maxOrNull() {
if (isEmpty) return null;
num max = first;
for (final n in this) {
if (n > max) max = n;
}
return max;
}