distinctBy<R> method
Returns a new lazy Iterable containing only elements from the collection
having distinct keys returned by the given selector
function.
The elements in the resulting list are in the same order as they were in the source collection.
Implementation
Iterable<T> distinctBy<R>(R Function(T element) selector) sync* {
final existing = HashSet<R>();
for (final current in this) {
if (existing.add(selector(current))) yield current;
}
}