minBy<R extends Comparable> method

E? minBy<R extends Comparable>(
  1. R f(
    1. E e
    )
)

Implementation

E? minBy<R extends Comparable>(R f(E e)) {
  if (this.isEmpty) return null;
  E result = elementAt(0);
  R max = f(result);
  forEach((element) {
    R r = f(element);
    int i = max.compareTo(r);
    if (i > 0) {
      max = r;
      result = element;
    }
  });
  return result;
}