FilePath class

A class to make it easier to manipulate file system entites. Once paths or entites are converted into Paths, they can be easily copied, deleted, joined, and their name retrieved.

Constructors

FilePath(dynamic entityOrString)
Create a new FilePath. The entityOrString parameter can be a FileSystemEntity or a String. If a String, this method converts the given path from a platform independent one to a platform dependent path. This conversion will work for relative paths but wouldn't make sense to use for absolute ones.

Properties

asDirectory → Directory
Assume the current file system entity is a Directory and return it as such. You would call this instead of entity when the file system entity does not yet exist.
read-only
asFile → File
Assume the current file system entity is a File and return it as such. You would call this instead of entity when the file system entity does not yet exist.
read-only
Assume the current file system entity is a Link and return it as such. You would call this instead of entity when the file system entity does not yet exist.
read-only
entity → FileSystemEntity
read-only
exists → bool
Return whether an entity actually exists for this path. The entity could be a File, Directory, or Link.
read-only
hashCode → int
The hash code for this object. [...]
read-only, override
isDirectory → bool
read-only
isFile → bool
read-only
read-only
length → int
Return the file length; if this FilePath is not a File, return 0.
read-only
name → String
read-only
parent FilePath
Returns the containing Path. Returns a non-null value even if this is a root directory. [...]
read-only
path → String
read-only
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

copy(FilePath destDir) FilePath
Copy the the entity to the given destination. Return the newly created FilePath.
createDirectory({bool recursive: false }) → Directory
Synchronously create the directory. See also Directory.createSync. [...]
createFile({bool recursive: false }) → File
Synchronously create the file. See also File.createSync. [...]
Synchronously create the link. See also Link.createSync. [...]
delete() → void
Delete the entity at the path.
join([dynamic arg0, String arg1, String arg2, String arg3, String arg4, String arg5, String arg6, String arg7, String arg8, String arg9 ]) FilePath
Join the given path elements to this path, and return a new FilePath object.
toString() → String
Returns a string representation of this object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
override

Static Properties

current FilePath
read-only

Static Methods

createSystemTemp([String prefix ]) FilePath
Creates a temporary directory in the system temp directory. See Directory.systemTemp and Directory.createTempSync. If prefix is missing or null, the empty string is used for prefix.