resolveSubTasks method

  1. @nonVirtual
List<HookTask> resolveSubTasks(
  1. Iterable<String> filePaths
)

Resolves the list of sub-tasks for the given file paths.

filePaths is the list of file paths to process post-filtering.

Implementation

@nonVirtual
List<HookTask> resolveSubTasks(Iterable<String> filePaths) {
  if (_subTasks case final tasks?) return tasks;

  final tasks = subTasks(filePaths);

  Iterable<HookTask> filterTasks() sync* {
    for (final task in tasks) {
      final filtered = task.filterFiles(filePaths);

      if (filtered.isNotEmpty) {
        yield task;
      }
    }
  }

  return _subTasks ??= filterTasks().toList();
}