max method

double? max()

Returns the largest value of all elements If collection is empty this returns null.

Example:

[9.0, 42.0, 3.0].max(); // 42.0

Implementation

double? max() {
  return maxBy((a, b) => a.compareTo(b));
}