uniquePath function

String uniquePath(
  1. String path
)

Returns path with empty and duplicate entries removed, keeping the first occurrence of each (order preserved). Used so the exported profile PATH never carries repeats a login shell may have accumulated.

Implementation

String uniquePath(String path) {
  final seen = <String>{};
  final unique = _entries(path).where(seen.add);
  return unique.join(':');
}