AggregateOperation<T, K, R> typedef

AggregateOperation<T, K, R> = R Function(K key, R? accumulator, T element, bool first)

A function that is invoked on each element.

The parameters are as followed:

  • The key is the key of the group this element belongs to.
  • The accumulator is the current value of the accumulator of the group. Can be null if it is the first element encountered in the group.
  • The element is the element from the source that is being aggregated.
  • And first indicates whether it's the first element encountered in the group.

Implementation

typedef AggregateOperation<T, K, R> = R Function(
  K key,
  R? accumulator,
  T element,
  bool first,
);