argMinBy<C extends Comparable<C> > method
Index of the element with minimum keyOf; null if empty.
Implementation
int? argMinBy<C extends Comparable<C>>(C Function(T) keyOf) {
int? idx;
C? minKey;
int i = 0;
for (final T e in this) {
final C k = keyOf(e);
if (minKey == null || k.compareTo(minKey) < 0) {
minKey = k;
idx = i;
}
i++;
}
return idx;
}