minBy method

T minBy(
  1. Comparator<T> comparable, {
  2. T orElse()?,
})

return min by comparable

Implementation

T minBy(Comparator<T> comparable, {T Function()? orElse}) {
  if (isEmpty) return (orElse ?? _throwNotFound)();
  return reduce(
    (value, element) => comparable(value, element) < 0 ? value : element,
  );
}