parent method

Option<Path> parent()

Returns the Path without its final component, if there is one. This means it returns Some("") for relative paths with one component. Returns None if the path terminates in a root or prefix, or if it’s the empty string.

Implementation

Option<Path> parent() => isWindows
    ? WindowsPath(_string).parent().map((e) => Path(e._string))
    : UnixPath(_string).parent().map((e) => Path(e._string));