run method
- @nonVirtual
- @override
- List<
String> filePaths, { - required void print(),
- required void completeTask(),
- required void startTask(),
override
Runs the task with the given file paths.
filePaths
is the list of file paths to process.
print
is a function to print messages.
completeTask
is a function to mark the task as complete.
startTask
is a function to mark the task as started.
Returns a FutureOr
Implementation
@nonVirtual
@override
FutureOr<int> run(
List<String> filePaths, {
required void Function(String?) print,
required void Function(HookTask, int) completeTask,
required void Function(HookTask) startTask,
}) async {
final futures = <Future<int>>[];
for (final task in subTasks(filePaths)) {
startTask(task);
Future<int> value() async {
return await task.run(
filePaths,
print: print,
completeTask: completeTask,
startTask: startTask,
);
}
futures.add(
value().then((code) {
completeTask(task, code);
if (code != 0) {
// ignore: only_throw_errors
throw code;
}
return code;
}),
);
}
try {
await Future.wait(futures);
} on int catch (code) {
return code;
}
completeTask(this, 0);
return 0;
}