distinctBy<T> function
Implementation
Iterable<T> distinctBy<T>(Iterable<T>? list, dynamic by(T input)) {
if (list == null) {
return [];
}
final keys = <dynamic>{};
return list.where((item) {
final key = by(item);
if (!keys.contains(key)) {
keys.add(key);
return true;
} else {
return false;
}
}).toList();
}