createCleanTask function
Create a "clean" task that removes all outputs of the given tasks.
Implementation
Task createCleanTask(
{String name = 'clean',
String description = '',
required Iterable<Task> tasks,
TaskPhase phase = TaskPhase.setup}) {
final allOutputs = tasks
.map((e) => e.runCondition)
.whereType<FilesCondition>()
.map((e) => e.outputs)
.toList(growable: false);
return Task((_) async => await ignoreExceptions(() => deleteOutputs(tasks)),
runCondition: RunToDelete(MultiFileCollection(allOutputs)),
name: name,
phase: phase,
description: description);
}