distinct method

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

Filters out consecutive duplicate payloads using equals (or identical / operator ==).

During the 2-phase LPDAG lazy-pull evaluation pass, this node pulls the upstream payload and compares it with the previous payload. If identical, this node's version does not advance (_isNewerThan returns false), short-circuiting downstream recomputations.

Data Propagation Flow

Upstream:   ──[A]──[A]──[B]──[B]──[C]──>
Distinct:   ──[A]───────[B]───────[C]──>
  • equals: Optional custom equality comparator. Defaults to identical(a, b) || a == b.

Ensures:

  • Returns a Bloom node that only propagates dirty notifications when values change.

Examples

final distinctUser = userBloom.distinct((prev, next) => prev.id == next.id);

Implementation

@pragma('vm:prefer-inline')
Bloom<T> distinct([bool Function(T previous, T next)? equals]) => _DistinctBloom<T>(this, equals: equals);