ExecutionQueue class
A queue for sequentially executing functions one at a time.
This class ensures that functions are executed in the order they are added, with only one function running at a time. When a function is added using the add method, it is placed at the end of the queue. The queue processes each function sequentially, starting the next function only after the current one has completed. The queue continues processing until it is empty.
The add method immediately schedules the function for execution, but it does not execute it until all previously added functions have finished. This allows for accurate control over the order and timing of function execution.
You can introduce a delay before a function executes by specifying a
buffer
duration. This is useful for scenarios where you need to throttle
execution.
- Annotations
-
- @Deprecated('"ExecutionQueue" has been replaced with "Sequential".')
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Checks if the queue is empty.
no setter
- isNotEmpty → bool
-
Checks if the queue is not empty.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add<
T> (TSyncOrAsyncMapper< dynamic, T> function, {Duration? buffer}) → FutureOr<T> -
Adds a new
function
to the queue. Thefunction
will be executed immediately after all previously added functions have completed. -
addAll(
Iterable< TSyncOrAsyncMapper> functions, {Duration? buffer}) → List<FutureOr> -
Adds multiple
functions
to the queue for sequential execution. See add. -
last(
) → FutureOr - Waits for all functions in the queue to complete, and return the result of the last function in the queue.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void -
Resets the prev result to
null
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited