minByOrNull<R extends Comparable<R>> method

T? minByOrNull<R extends Comparable<R>>(
  1. R by(
    1. T item
    ), [
  2. T? ifNull
])

Implementation

T? minByOrNull<R extends Comparable<R>>(R by(T item), [T? ifNull]) {
  T? _min;
  for (final t in this) {
    if (_min == null || (by(t).compareTo(by(_min))) < 0) {
      _min = t;
    }
  }
  return _min ?? ifNull;
}