dedup method

void dedup()

Removes consecutive repeated elements in the vector according to ==. If the vector is sorted, this removes all duplicates.

Implementation

void dedup() {
  late T last;
  bool first = true;
  removeWhere((element) {
    if (first) {
      last = element;
      first = false;
      return false;
    }
    if (element == last) {
      return true;
    }
    last = element;
    return false;
  });
}