maxOrNull property

Bloom<E?> get maxOrNull

Returns the maximum element in this collection, or null if empty.

Ensures:

  • Evaluates to null when the source collection is empty.
  • Returns the largest element according to Comparable.compareTo.

Implementation

Bloom<E?> get maxOrNull => computed((via) {
      final source = via(bloom);
      if (source.isEmpty) return null;
      return source.reduce((a, b) => a.compareTo(b) > 0 ? a : b);
    });