min method
Returns the least number in this
, or null
if this
is empty.
Example:
[104, 3, 18].min().value; // 3
If compare
is provided, it will be used to order the elements.
Example:
[-100, -200, 5].min((a, b) =>
a.toString().length.compareTo(b.toString().length)).value; // 5
Implementation
E? min([Comparator<E>? compare]) => this.isEmpty
? null
: this.reduce(
compare == null ? math.min : _generateCustomMinFunction<E>(compare));