Context class
An instantiable class for manipulating paths. Unlike the top-level functions, this lets you explicitly select what platform the paths will use.
Constructors
Properties
- current → String
-
The current directory that relative paths are relative to.
read-only
- separator → String
-
Gets the path separator for the context's style. On Mac and Linux,
this is
/. On Windows, it's\.read-only - style → InternalStyle
-
The style of path that this context works with.
final
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
absolute(
String part1, [ String part2, String part3, String part4, String part5, String part6, String part7 ]) → String - Creates a new path by appending the given path parts to current. Equivalent to join() with current as the first argument. Example: [...]
-
basename(
String path) → String -
Gets the part of
pathafter the last separator on the context's platform. [...] -
basenameWithoutExtension(
String path) → String -
Gets the part of
pathafter the last separator on the context's platform, and without any trailing file extension. [...] -
canonicalize(
String path) → String -
Canonicalizes
path. [...] -
dirname(
String path) → String -
Gets the part of
pathbefore the last separator. [...] -
equals(
String path1, String path2) → bool -
Returns
trueifpath1points to the same location aspath2, andfalseotherwise. [...] -
extension(
String path) → String -
Gets the file extension of
path: the portion of basename from the last.to the end (including the.itself). [...] -
fromUri(
dynamic uri) → String -
Returns the path represented by
uri, which may be a String or a Uri. [...] -
hash(
String path) → int -
Returns a hash code for
paththat matches the semantics of equals. [...] -
isAbsolute(
String path) → bool -
Returns
trueifpathis an absolute path andfalseif it is a relative path. [...] -
isRelative(
String path) → bool -
Returns
trueifpathis a relative path andfalseif it is absolute. On POSIX systems, absolute paths start with a/(forward slash). On Windows, an absolute path starts with\\, or a drive letter followed by:/or:\. -
isRootRelative(
String path) → bool -
Returns
trueifpathis a root-relative path andfalseif it's not. [...] -
isWithin(
String parent, String child) → bool -
Returns
trueifchildis a path beneathparent, andfalseotherwise. [...] -
join(
String part1, [ String part2, String part3, String part4, String part5, String part6, String part7, String part8 ]) → String - Joins the given path parts into a single path. Example: [...]
-
joinAll(
Iterable< String> parts) → String - Joins the given path parts into a single path. Example: [...]
-
normalize(
String path) → String -
Normalizes
path, simplifying it by handling.., and., and removing redundant path separators whenever possible. [...] -
prettyUri(
dynamic uri) → String -
Returns a terse, human-readable representation of
uri. [...] -
relative(
String path, { String from }) → String -
Attempts to convert
pathto an equivalent relative path relative toroot. [...] -
rootPrefix(
String path) → String -
Returns the root of
pathif it's absolute, or an empty string if it's relative. [...] -
setExtension(
String path, String extension) → String -
Returns
pathwith the trailing extension set toextension. [...] -
split(
String path) → List< String> -
Splits
pathinto its components using the current platform's separator. Example: [...] -
toUri(
String path) → Uri -
Returns the URI that represents
path. [...] -
withoutExtension(
String path) → String -
Removes a trailing extension from the last part of
path. [...] -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited