max method
Returns the maximum of this Iterable. The elements need to be
Comparable, unless a custom comparator
is provided.
Throws a StateError if the iterable is empty, unless an orElse
function is provided.
For example
[3, 1, 2].max()
returns 3
.
Implementation
E max({Comparator<E>? comparator, E Function()? orElse}) =>
(comparator ?? naturalCompare).maxOf(this, orElse: orElse);