minBy method

T? minBy(
  1. Comparable<Object?> value(
    1. T item
    )
)

Item with the smallest value, or null when empty. products.minBy((p) => p.price)

Implementation

T? minBy(Comparable<Object?> Function(T item) value) => isEmpty ? null : reduce((T a, T b) => value(a).compareTo(value(b)) <= 0 ? a : b);