argmax function

int argmax(
  1. List<num> array
)

Implementation

int argmax(List<num> array) {
  return array
      .reduceIndexed((index, previous, element) =>
          array[previous.toInt()] < element ? index : previous)
      .toInt();
}