join method

PathUri join(
  1. PathUri other
)

Joins the current path with another path.

If the current path is not a directory a StateError will be thrown. See isDirectory for checking if the current path is a directory.

Implementation

PathUri join(PathUri other) {
  if (!isDirectory) {
    throw StateError('$this is not a directory.');
  }

  return PathUri(
    isAbsolute: isAbsolute,
    isDirectory: other.isDirectory,
    pathSegments: pathSegments.rebuild((b) => b.addAll(other.pathSegments)),
  );
}