include static method
Returns a list of paths from which will be removed elements that do not match glob pattern.
Parameters:
files
List of file paths.
pattern
Pattern of glob filter.
added
Function that is called whenever an item is added.
caseSensitive
True, if the pattern is case sensitive; otherwise false.
removed
Function that is called whenever an item is removed.
Implementation
static List<String> include(List<String> files, String pattern,
{void Function(String path)? added,
bool? caseSensitive,
void Function(String path)? removed}) {
pattern = FilePath.expand(pattern);
if (!pathos.isAbsolute(pattern)) {
pattern = getcwd() + '/' + pattern;
}
final isDirectory = (String path) {
return Directory(path).existsSync();
};
final filter = GlobFilter(pattern,
caseSensitive: caseSensitive,
isDirectory: isDirectory,
isWindows: _isWindows);
return filter.include(files, added: added, removed: removed);
}