matchesAnyPathPattern function
Checks if the provided path matches any of the specified pathPatterns,
which are regular expressions.
The path is matched with forward slashes as separators on every platform
(lib\src\a.dart is matched as lib/src/a.dart), so write patterns
with /.
An empty pathPatterns matches nothing and returns false. A caller that
treats "no patterns" as "no filter" must check for that itself.
Implementation
bool matchesAnyPathPattern(String path, Set<String> pathPatterns) {
final posixPath = path.replaceAll('\\', '/');
for (final pattern in pathPatterns) {
if (RegExp(pattern).hasMatch(posixPath)) return true;
}
return false;
}