min property

T get min

Returns the minimum value in the list.

Only works with numeric types (num, int, double). Throws StateError if the list is empty. Throws UnsupportedError for non-numeric types.

Implementation

T get min {
  if (isEmpty) {
    throw StateError('Cannot get min of empty list');
  }
  if (T == int || T == double || T == num) {
    return reduce((a, b) => (a as num) < (b as num) ? a : b);
  }
  throw UnsupportedError('Min is only supported for numeric types');
}