filterFiles method

List<String> filterFiles(
  1. Iterable<String> filePaths
)

Filters the given file paths based on the include and exclude patterns.

filePaths is the list of file paths to filter.

Returns a list of filtered file paths.

Implementation

List<String> filterFiles(Iterable<String> filePaths) {
  Iterable<String> filesFor(Iterable<String> filePaths) sync* {
    for (final path in filePaths) {
      if (exclude.any((e) => e.allMatches(path).isNotEmpty)) {
        continue;
      }

      if (include.any((e) => e.allMatches(path).isNotEmpty)) {
        yield path;
      }
    }
  }

  return filesFor(filePaths).toList();
}