FunctionQueue class
A queue that executes functions in order, one at a time.
Each function is wrapped in a _Queueable
object that contains a completer
and the function itself. When a new function is added to the queue via the
add method, it is wrapped in a new _Queueable
object and added to the
end of the queue. If the first function in the queue is finished executing,
the _execute
method runs the next function in the queue. The _execute
method continues to execute functions until it reaches a function that is
still running, or until the queue is empty.
Functions can be buffered by providing a buffer
duration. When a function
is added to the queue with a buffer, the function is wrapped in a new
function that waits for the buffer to complete before executing the
original function. This is useful for batching up changes to a Firestore
document, for example.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
no setter
- isNotEmpty → bool
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add<
T> (Future< T> f(), {Duration? buffer}) → Future<T> - Adds a new function to the queue and returns a completer for the result.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
wait(
) → Future< void>
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited