Semaphore class

A semaphore prevents asynchronous code from being executed simultaneously.

Constructors

Semaphore()

Properties

completer Completer?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isLocked bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

debounce<TResult>(FutureOr<TResult> job(), {Duration delay = const Duration(milliseconds: 250)}) Future<TResult?>
Function job is only executed when no other job is scheduled within the delay period.
lock() Future
Locks the semaphore. The Future completes as soon as the semaphore is released and can be locked again.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
release() → void
Releases the current lock on the semaphore.
runLocked<TResult>(FutureOr<TResult> job()) Future<TResult>
Function job is executed immediately if the semaphore is not locked, as soon as the last scheduled job finishes otherwise.
throttle<TResult>(FutureOr<TResult> job()) Future<TResult?>
Function job is executed only if the semaphore is not locked.
toString() String
A string representation of this object.
inherited

Operators

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