shouldIncludeFile function

bool shouldIncludeFile(
  1. String fileName,
  2. List<String> include,
  3. List<String> exclude
)

Check if a filename should be included based on include/exclude glob patterns.

Implementation

bool shouldIncludeFile(
    String fileName, List<String> include, List<String> exclude) {
  if (include.isNotEmpty) {
    final matchesInclude =
        include.any((pattern) => _globMatches(pattern, fileName));
    if (!matchesInclude) return false;
  }

  if (exclude.isNotEmpty) {
    final matchesExclude =
        exclude.any((pattern) => _globMatches(pattern, fileName));
    if (matchesExclude) return false;
  }

  return true;
}