distinctBy method
Distinct the list by f
.
Returns a new list with distinct elements based on f
.
Implementation
List<T> distinctBy(dynamic Function(T) f) {
final list = <T>[];
for (final item in this) {
if (!list.any((e) => f(e) == f(item))) list.add(item);
}
return list;
}