distinctUnique method

Stream<T> distinctUnique({
  1. bool equals(
    1. T e1,
    2. T e2
    )?,
  2. int hashCode(
    1. T e
    )?,
})

WARNING: More commonly known as distinct in other Rx implementations. Creates a Stream where data events are skipped if they have already been emitted before.

Equality is determined by the provided equals and hashCode methods. If these are omitted, the '==' operator and hashCode on the last provided data element are used.

The returned stream is a broadcast stream if this stream is. If a broadcast stream is listened to more than once, each subscription will individually perform the equals and hashCode tests.

Interactive marble diagram

Implementation

Stream<T> distinctUnique({
  bool Function(T e1, T e2)? equals,
  int Function(T e)? hashCode,
}) =>
    DistinctUniqueStreamTransformer<T>(
            equals: equals, hashCodeMethod: hashCode)
        .bind(this);