ParallelTasks class

A task that runs a series of sub-tasks in parallel on a set of files.

The ParallelTasks class extends HookTask and is used to execute a list of sub-tasks concurrently. Each sub-task is executed independently of the others, and the overall task completes successfully only if all sub-tasks complete successfully (i.e., return a zero exit code).

Example usage:

ParallelTasks(
  tasks: [
    ShellTask(
      include: [Glob('**.dart')],
      commands: (filePaths) => [
        'dart format ${filePaths.join(' ')}',
      ],
    ),
    ShellTask(
      include: [Glob('**.dart')],
      commands: (filePaths) => [
        'sip test --concurrent --bail',
      ],
    ),
  ],
);

The above example creates a ParallelTasks instance that runs two ShellTask instances concurrently. The first task formats Dart files, and the second task runs tests on the Dart files.

Inheritance

Constructors

ParallelTasks({required List<HookTask> tasks, List<Pattern> exclude = const [], String? name})

Properties

exclude → List<Pattern>
The list of patterns to exclude files.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
id → String
The unique identifier for the task.
finalinherited
include → List<Pattern>
The list of patterns to include files.
finalinherited
name → String?
The name of the task.
final
patternName → String
Gets the pattern name for the task.
no setterinherited
resolvedName → String
Gets the resolved name for the task.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shouldAlwaysRun → bool
no setterinherited
workingDirectory → String?
finalinherited

Methods

filterFiles(Iterable<String> filePaths) → List<String>
Filters the given file paths based on the include and exclude patterns.
inherited
label(Iterable<String> filePaths) → TaskLabel
Creates a label for the task with the given file paths.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(List<String> filePaths, int index) → ResolvedHookTask
Resolves the task with the given file paths and index.
inherited
resolveSubTasks(Iterable<String> filePaths) → List<HookTask>
Resolves the list of sub-tasks for the given file paths.
inherited
run(List<String> filePaths, {required void print(String?), required void completeTask(HookTask, int), required void startTask(HookTask), required String? workingDirectory}) → FutureOr<int>
Runs the task with the given file paths.
override
subTasks(Iterable<String> filePaths) → List<HookTask>
Gets the list of sub-tasks for the given file paths.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited