average property

Bloom<double> get average

Returns the arithmetic average of all integers in this collection reactively.

Requires:

  • The collection MUST NOT be empty.

Throws:

  • StateError if the collection is empty upon evaluation.

Implementation

Bloom<double> get average => computed((via) {
      final source = via(bloom);
      if (source.isEmpty) throw StateError('No element');
      return source.average;
    });