matchesAnyPathPattern function

bool matchesAnyPathPattern(
  1. String path,
  2. Set<String> pathPatterns
)

Checks if the provided path matches any of the specified pathPatterns.

Implementation

bool matchesAnyPathPattern(String path, Set<String> pathPatterns) {
  if (pathPatterns.isNotEmpty) {
    final localSystemFilePath = toLocalSystemPathFormat(path);
    for (final pattern in pathPatterns) {
      if (RegExp(pattern).hasMatch(localSystemFilePath)) return true;
    }
    return false;
  }
  return true;
}