distinctBy<T> method

Iterable<E> distinctBy<T>(
  1. T distinctBy(
    1. E e
    )
)

Implementation

Iterable<E> distinctBy<T>(T Function(E e) distinctBy) {
  final uniqueItems = <T, E>{};
  for (var e in this) {
    uniqueItems[distinctBy(e)] = e;
  }
  return uniqueItems.values;
}