executor_lib library

Provides an abstraction for executing jobs.

Classes

ConcurrencyExecutor
An executor that limits the number of jobs running concurrently. Executes jobs in LIFO order, queueing additional jobs once the concurrency limit is reached. If the maximum queue size is reached, oldest jobs are completed with a CancellationException.
DirectExecutor
Directly runs jobs by scheduling them as a microtask
Executor
An executor runs Jobs
ExecutorDelegate
provides additional methods for executors that are intended to be used as a delegate.
ImmediateExecutor
an executor that invokes the compute function immediately when submitted.
IsolateExecutor
Runs jobs on a single isolate.
Job<Q, R>
a job for execution on an Executor
PoolExecutor
Runs jobs on a pool of isolates. Uses isolate affinity for jobs having the same deduplication key, otherwise uses round robin to select an isolate.
QueueExecutor
Runs jobs on the UI thread.

Extensions

CancellationFuture on Future<T>
Thrown when a job is cancellled

Functions

newExecutor({required int concurrency}) Executor
Creates a new executor with the given concurrency. Uses isolates unless in debug mode

Exceptions / Errors

CancellationException
thrown when a job is cancelled