distinctBy<K> method
Returns distinct elements by key.
users.distinctBy((u) => u.id)
Implementation
Iterable<T> distinctBy<K>(K Function(T) key) sync* {
final seen = <K>{};
for (final e in this) {
if (seen.add(key(e))) yield e;
}
}