DistinctUniqueStreamTransformer<T> class

Create an Observable which implements a HashSet under the hood, using the provided equals as equality.

The Observable will only emit an event, if that event is not yet found within the underlying HashSet.


new Stream.fromIterable([1, 2, 1, 2, 1, 2, 3, 2, 1])
    .listen((event) => print(event));

will emit: 1, 2, 3

The provided equals must define a stable equivalence relation, and hashCode must be consistent with equals.

If equals or hashCode are omitted, the set uses the elements' intrinsic Object.== and Object.hashCode. If you supply one of equals and hashCode, you should generally also to supply the other.


DistinctUniqueStreamTransformer({bool equals(T e1, T e2), int hashCode(T e)})
Constructs a StreamTransformer which emits events from the source Stream as if they were processed through a HashSet. [...]


hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited


bind(Stream<T> stream) → Stream<T>
Transforms the provided stream. [...]
cast<RS, RT>() → StreamTransformer<RS, RT>
Provides a StreamTransformer<RS, RT> view of this stream transformer.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
toString() → String
Returns a string representation of this object.


operator ==(dynamic other) → bool
The equality operator.