max method

E? max([
  1. Comparator<E>? compare
])

Returns the greatest number in this, or null if this is empty.

Example:

    [-47, 10, 2].max((a, b) =>
    a.toString().length.compareTo(b.toString().length)).value; // -47

Implementation

E? max([Comparator<E>? compare]) => isEmpty
    ? null
    : reduce(
        compare == null ? math.max : _generateCustomMaxFunction<E>(compare));