min property

  1. @useResult
E? get min

The minimum element in this iterable, or null if empty.

['b', 'a', 'c'].min; // 'a'

Implementation

@useResult E? get min {
  final iterator = this.iterator;
  if (!iterator.moveNext()) {
    return null;
  }

  var min = iterator.current;
  while (iterator.moveNext()) {
    final element = iterator.current;
    if (min.compareTo(element) > 0) {
      min = element;
    }
  }

  return min;
}