min method

E min({
  1. Comparator<E>? comparator,
  2. E orElse()?,
})

Returns the minimum of this Iterable. The elements need to be Comparable, unless a custom comparator is provided.

Throws a StateError if the iterable is empty, unless an orElse function is provided.

For example

[3, 1, 2].min()

returns 1.

Implementation

E min({Comparator<E>? comparator, E Function()? orElse}) =>
    (comparator ?? naturalCompare).minOf(this, orElse: orElse);