sum property

Bloom<E> get sum

Returns the sum of all elements in this collection reactively.

Ensures:

  • Returns 0 or 0.0 when the collection is empty.

Implementation

Bloom<E> get sum => computed((via) {
      final val = via(bloom).sum;
      if (val is E) return val;
      if (E == double) return val.toDouble() as E;
      return val.toInt() as E;
    });