max property

T max

Get the maximum value of a collection of numbers

Implementation

T get max {
  if (isEmpty) {
    final String type = T.toString();
    if (type == 'int') return 0 as T;
    if (type == 'double') return 0.0 as T;
    if (type == 'num') return 0 as T;
  }
  if (length == 1) return first;
  sort();
  return last;
}