maxBy method
Returns the element that gives the maximum value with respect to the specified comparison function.
Implementation
T? maxBy(int Function(T, T) f) {
T max;
if (moveNext()) {
max = current;
} else {
return null;
}
for (final element in this) {
if (f(element, max) > 0) {
max = element;
}
}
return max;
}