AsyncLock<T> class

A lock that ensures that only one async function executes at a time.

Constructors

AsyncLock(Future<T> function(), {bool retainFutureErrors = false})
Creates a new AsyncLock.

Properties

function → Future<T> Function()
The function to execute.
final
hashCode → int
The hash code for this object.
no setterinherited
retainFutureErrors → bool
Whether to retain errors or allow reentrancy until the Future completes successfully.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

execute([Duration timeout = const Duration(minutes: 5)]) → Future<T>
Executes the given function and returns the value, but ensures that only one async function executes at a time. The call defaults to a timeout of 5 minutes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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