Path extension type

This type supports a number of operations for inspecting a path, including breaking the path into its components, extracting the file name, determining whether the path is absolute, and so on.

on
Implemented types

Constructors

Path(String string)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
string String
final

Methods

ancestors() Iterable<Path>
canonicalize() Path
components() Iterable<Component>
display() String
String representation of the path
endsWith(Path other) bool
Determines whether other is a suffix of this.
exists() Future<bool>
Determines whether file exists on disk.
existsSync() bool
Determines whether file exists on disk.
extension() String
Extracts the extension (without the leading dot) of self.file_name, if possible.
fileName() String
Returns the final component of the Path, if there is one.
filePrefix() → Option<String>
Extracts the portion of the file name before the first "." -
fileStem() → Option<String>
Extracts the portion of the file name before the last "." -
hasRoot() bool
Returns true if the Path has a root.
isAbsolute() bool
Returns true if the Path is absolute, i.e., if it is independent of the current directory.
isDir() Future<bool>
Returns true if the path exists on disk and is pointing at a directory. Does not follow links.
isDirSync() bool
Returns true if the path exists on disk and is pointing at a directory. Does not follow links.
isFile() Future<bool>
Returns true if the path exists on disk and is pointing at a regular file. Does not follow links.
isFileSync() bool
Returns true if the path exists on disk and is pointing at a regular file. Does not follow links.
isRelative() bool
Returns true if the Path is relative, i.e., not absolute.
Returns true if the path exists on disk and is pointing at a symlink. Does not follow links.
isSymlinkSync() bool
Returns true if the path exists on disk and is pointing at a symlink. Does not follow links.
iter() → Iter<String>
Produces an iterator over the path’s components viewed as Strings
join(Path other) Path
Creates an Path with path adjoined to this.
metadata() Future<Metadata>
Queries the file system to get information about a file, directory, etc. Note: using this method means that the program can no longer compile for the web.
metadataSync() → Metadata
Queries the file system to get information about a file, directory, etc. Note: using this method means that the program can no longer compile for the web.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parent() → Option<Path>
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.
readDir() Future<Result<ReadDir, IoError>>
Returns an iterator over the entries within a directory. Note: using this method results in the program no longer being able to compile to web.
readDirSync() → Result<ReadDir, IoError>
Returns an iterator over the entries within a directory. Note: using this method results in the program no longer being able to compile to web.
Reads a symbolic link, returning the file that the link points to.
readLinkSync() → Result<Path, IoError>
Reads a symbolic link, returning the file that the link points to.
startsWith(Path other) bool
Determines whether other is a prefix of this.
stripPrefix(Path prefix) → Option<Path>
Returns a path that, when joined onto base, yields this. Returns None if prefix is not a subpath of base.
symlinkMetadata() Future<Result<Metadata, IoError>>
Returns the metadata for the symlink. Note: using this method means that the program can no longer compile for the web.
symlinkMetadataSync() → Result<Metadata, IoError>
Returns the metadata for the symlink. Note: using this method means that the program can no longer compile for the web.
toString() String
A string representation of this object.
inherited
withExtension(String extension) Path
Creates an Path like this but with the given extension.
withFileName(String fileName) Path
Creates an PathBuf like this but with the given file name.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isIoSupported() bool
Returns whether io operations are supported. If false, is currently running on the web.