Lock class Null safety

Object providing the implicit lock.

A Lock can be reentrant (in this case it will use a Zone).

non-reentrant lock is used like an aync executor with a capacity of 1.

if timeout is not null, it will timeout after the specified duration.

Constructors

Lock({bool reentrant = false})
Creates a Lock object. [...]
factory

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
inLock bool
for reentrant, test whether we are currently in the synchronized section. for non reentrant, it returns the locked status.
read-only
locked bool
returns true if the lock is currently locked.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
synchronized<T>(FutureOr<T> computation(), {Duration? timeout}) Future<T>
Executes computation when lock is available. [...]
toString() String
A string representation of this object. [...]
inherited

Operators

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