distinct method

EventSubscriptionBuilder<T> distinct([
  1. bool equals(
    1. T previous,
    2. T next
    )?
])

Skips data events if they are equal to the previous data event.

It extends the current builder so that only distinct inputs that pass the equals clause will be kept for the EventHandler.

Implementation

EventSubscriptionBuilder<T> distinct([
  bool Function(T previous, T next)? equals,
]) {
  return _DistinctEventSubscriptionBuilder(
    parent: this,
    equals: equals ?? (prev, curr) => prev == curr,
  );
}