TaskManager class

Constructors

TaskManager({int maxConcurrent = 4})

Properties

disposed → bool
no setter
events → Stream<TaskEvent>
no setter
hashCode → int
The hash code for this object.
no setterinherited
maxConcurrent → int
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stats → TaskManagerStats
Get summary statistics.
no setter

Methods

cancel(String taskId, [String reason = 'Cancelled by user']) → void
Cancel a running or queued task.
cancelAll([String reason = 'All tasks cancelled']) → void
Cancel all tasks.
dispose() → void
Dispose the task manager. Cancels all running tasks.
getLog(String taskId) → TaskLog?
Get execution log for a task.
getProgress(String taskId) → TaskProgress?
Get task progress.
getResult(String taskId) → TaskResult?
Get the result of a completed task.
getStatus(String taskId) → TaskStatus?
Get the status of a task.
getTask(String taskId) → BackgroundTask?
Get a task by ID.
launch<T>({required String name, required TaskFunction<T> function, TaskPriority priority = TaskPriority.normal, Duration? timeout, String? id}) → String
Launch a new task. Returns the task ID.
listTasks({TaskStatus? status}) → List<BackgroundTask>
List all tasks, optionally filtered by status.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pruneCompleted() → int
Remove completed/cancelled/failed tasks from the registry.
toJson() → List<Map<String, dynamic>>
Export all tasks as JSON.
toString() → String
A string representation of this object.
inherited
waitForAll() → Future<void>
Wait for all running tasks to complete.
waitForTask(String taskId) → Future<TaskResult?>
Wait for a specific task to complete.

Operators

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