ResolvedHook constructor

ResolvedHook({
  1. required List<String> filePaths,
  2. required List<ResolvedHookTask> tasks,
})

Implementation

ResolvedHook({
  required this.filePaths,
  required this.tasks,
}) {
  Iterable<ResolvedHookTask> subTasks(ResolvedHookTask task) sync* {
    for (final subTask in task.subTasks) {
      yield subTask;
      yield* subTasks(subTask);
    }
  }

  final allTasks = [
    for (final task in tasks) ...[
      task,
      ...subTasks(task),
    ],
  ];

  tasksById = {
    for (final task in allTasks) task.original.id: task,
  };
}