max method

int? max()

Returns the largest value of all elements

Example:

[9, 42, 3].max(); // 42

Implementation

int? max() {
  return maximumBy((a, b) => a.compareTo(b));
}