dedupBy method
Removes all but the first of consecutive elements in the vector satisfying a given equality relation. If the vector is sorted, this removes all duplicates.
Implementation
void dedupBy(bool Function(T a, T b) f) {
late T last;
bool first = true;
removeWhere((element) {
if (first) {
last = element;
first = false;
return false;
}
if (f(element, last)) {
return true;
}
last = element;
return false;
});
}