Skip to content
pubscout

glob

2.2.0, released 3 months ago by tools.dart.dev

A file and directory globbing library that supports Bash-style path matching and listing.

Rock solid
$ flutter pub add glob
Source repository

What it does

Performs Bash-style file and directory globbing in Dart. It allows developers to check whether a path matches a specific pattern, or recursively list filesystem entities matching a glob pattern using POSIX path syntax.

AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to filter files or paths using wildcards like `*` or `**`
  • You want to recursively list files in a directory matching specific extensions or patterns

Skip it when

  • You only need basic path manipulation provided natively by `package:path`
  • You need complex recursive directory traversal without glob pattern matching

Strengths

  • Supports familiar Bash-style glob syntax including wildcards, character ranges, and option expansion
  • Works consistently across cross-platform environments using POSIX path syntax
  • Integrates seamlessly with `package:file` for filesystem operations

Weaknesses

  • Combinatorial option expansions exceeding 10,000 branches will throw a FormatException
  • Requires using specific imports or a FileSystem object for filesystem listing APIs since version 2.0.0

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
5

none

import 'package:glob/glob.dart';

final dartFile = Glob("**.dart");

void main(List<String> arguments) {
  for (var argument in arguments) {
    if (dartFile.matches(argument)) print(argument);
  }
}

Works with

Packages commonly used together with glob: ones it builds on, ones built on it, and its own family.