Glob class
A glob for matching and listing files and directories.
A glob matches an entire string as a path. Although the glob pattern uses
POSIX syntax, it can match against POSIX, Windows, or URL paths. The format
it expects paths to use is based on the context
parameter to new Glob;
it defaults to the current system's syntax.
Paths are normalized before being matched against a glob, so for example the
glob foo/bar
matches the path foo/./bar
. A relative glob can match an
absolute path and vice versa; globs and paths are both interpreted as
relative to context.current
, which defaults to the current working
directory.
When used as a Pattern
, a glob will return either one or zero matches for
a string depending on whether the entire string matches the glob. These
matches don't currently have capture groups, although this may change in the
future.
Constructors
Properties
- caseSensitive → bool
-
Whether the glob matches paths case-sensitively.
read-only
- context → Context
-
The context in which paths matched against this glob are interpreted.
final
- pattern → String
-
The pattern used to create this glob.
final
- recursive → bool
-
If true, a path matches if it matches the glob itself or is recursively
contained within a directory that matches.
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
-
allMatches(
String path, [ int start = 0 ]) → Iterable< Match> - Match this pattern against the string repeatedly. [...]
-
list(
{String root, bool followLinks: true }) → Stream< FileSystemEntity> -
Lists all
FileSystemEntity
s beneathroot
that match the glob. [...] -
listSync(
{String root, bool followLinks: true }) → List< FileSystemEntity> -
Synchronously lists all
FileSystemEntity
s beneathroot
that match the glob. [...] -
matchAsPrefix(
String path, [ int start = 0 ]) → Match -
Match this pattern against the start of
string
. [...] -
matches(
String path) → bool -
Returns whether this glob matches
path
. -
toString(
) → String - Returns a string representation of this object.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator.
inherited
Static Methods
-
quote(
String contents) → String -
Returns
contents
with characters that are meaningful in globs backslash-escaped.