dedup method

void dedup()

With co-regions we can have multiple states that collapse into a single state. This can result in duplicate paths so we need to reduce the duplicates to a single state.

Implementation

void dedup() {
  final deduped = _leafPaths.toSet().toList();
  if (deduped.length != _leafPaths.length) {
    _leafPaths
      ..clear()
      ..addAll(deduped);
  }
}