distinctBy<R> method

Stream<T> distinctBy<R>(
  1. R keySelector(
    1. T
    ), {
  2. Equality<R>? equals,
})

Skips data events if their key are equal to the key of the previous data event.

Implementation

Stream<T> distinctBy<R>(
  R Function(T) keySelector, {
  Equality<R>? equals,
}) {
  final eq = equals ?? defaultEquals;
  return distinct(
    (e1, e2) => eq(
      keySelector(e1),
      keySelector(e2),
    ),
  );
}