match static method

bool match(
  1. String path,
  2. String pattern
)

Returns true if path matches pattern.

pattern may contain * (match any chars except /), ? (one char except /), and ** (match zero or more path segments). Segment separator is /. Matching is case-sensitive.

Example:

GlobUtils.match('lib/foo.dart', 'lib/*.dart');  // true
GlobUtils.match('a/b/c', 'a/**/c');            // true

Implementation

static bool match(String path, String pattern) {
  if (path.isEmpty && pattern.isEmpty) return true;
  if (path.isEmpty || pattern.isEmpty) return false;
  return _matchSegments(path.split('/'), 0, pattern.split('/'), 0);
}