ConcurrentTaskBatch<T extends Object> class

A task batch that executes its collection of tasks concurrently.

All tasks are started at the same time and run in parallel. The batch-level onError and eagerError settings control how failures are handled across the entire set of parallel operations.

Inheritance

Constructors

ConcurrentTaskBatch({bool eagerError = true, Duration? minTaskDuration, @sendable TOnTaskError? onError, @sendable TOnTaskConpletedCallback<T>? onTaskCompleted})
ConcurrentTaskBatch.from(ConcurrentTaskBatch<T> other)
Creates a new batch from an existing one, copying its configuration and tasks.
factory

Properties

executionCount → int
The total number of tasks to be executed in the current batch.
no setteroverride
executionIndex → int
The index of the currently executing task. Zero-based.
no setteroverride
executionProgress → double
The execution progress as a value between 0.0 and 1.0. Returns 0.0 if executionCount is zero.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
isExecuting → bool
Indicates if the batch is actively processing tasks.
no setteroverride
isNotExecuting → bool
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tasks ↔ Queue<Task<T>>
A protected queue of tasks awaiting processing, typically in FIFO order.
getter/setter pairinherited

Methods

add(TTaskHandler<T> handler, {TOnTaskError? onError, bool? eagerError, Duration? minTaskDuration}) → void
Adds a task, applying batch-level defaults for any unspecified parameters.
override
addAllTasks(Iterable<Task<T>> newTasks) → void
Adds multiple Task objects to the end of the queue.
inherited
addTask(Task<T> task) → void
Adds a pre-configured Task to the end of the queue.
inherited
clearTasks() → bool
Clears all tasks from the queue.
inherited
executeTasks() → TResolvableOption<T>
Executes all tasks in the queue concurrently using a custom wait utility.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeFirstTask() → bool
Removes the first task from the queue.
inherited
removeLastTask() → bool
Removes the last task from the queue.
inherited
removeTask(Task<T> task) → bool
Removes a specific task from the queue.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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