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.

Example

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.

Inheritance

Constructors

DistinctUniqueStreamTransformer({bool equals(T e1, T e2), int hashCode(T e) })

Properties

transformer StreamTransformer<T, T>
final
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

Methods

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

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited