DartTask class
A task that runs Dart code on a set of files.
The DartTask class extends HookTask and is used to execute custom Dart code on the included files. The task is considered successful if the provided run function returns a zero exit code.
Example usage:
DartTask(
include: [Glob('**.dart')],
run: (filePaths) async {
print('Running custom task');
// Perform custom operations on the file paths
return 0; // Return 0 on success, non-zero on failure
},
);
The above example creates a DartTask instance that runs custom Dart code on all Dart files in the project.
Constructors
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
Methods
-
filterFiles(
Iterable< String> filePaths) → List<String> -
Filters the given file paths based on the include and exclude
patterns.
inherited
-
getSubTasks(
Iterable< String> filePaths) → List<HookTask> -
Gets the list of sub-tasks for the given file paths.
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
-
run(
List< String> filePaths, {required void print(String?), required void completeTask(HookTask, int), required void startTask(HookTask)}) → Future<int> -
Runs the task with the given file paths.
override
-
subTasks(
Iterable< String> filePaths) → List<HookTask> -
Returns the list of sub-tasks for the given file paths.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited