argMax<T extends num> function

int argMax<T extends num>(
  1. List<T> list
)

Returns the index of the largest element in the list

Implementation

int argMax<T extends num>(List<T> list) {
  return list
      .asMap()
      .entries
      .reduce(
          (MapEntry<int, T> l, MapEntry<int, T> r) => l.value > r.value ? l : r)
      .key;
}