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