arrayMax<T extends num> function

T? arrayMax<T extends num>(
  1. List<T> array
)

Implementation

T? arrayMax<T extends num>(List<T> array) {
  if (array.isEmpty) return null; // return -99999999;

  var max = array[0];

  for (var i = 1, l = array.length; i < l; ++i) {
    if (array[i] > max) max = array[i];
  }

  return max;
}