Path constructor

Path(
  1. String pathString
)

Parses pathString: segments separated by /, empty segments ignored, so a/b, /a/b and /a//b/ are the same path.

Implementation

factory Path(String pathString) {
  if (pathString.isEmpty || pathString == '/') {
    return empty;
  }
  return Path.fromKeys(<ChildKey>[
    for (final String piece in pathString.split('/'))
      if (piece.isNotEmpty) ChildKey(piece),
  ]);
}