NamedLock class

A NamedLock can be used to control access to a resource across processes and isolates.

Constructors

NamedLock({required String suffix, String? lockPath, String description = '', String name = 'dcli.lck', Duration timeout = const Duration(seconds: 30)})
!!DEPRECATED!! lockPath was the path of the directory used to store the lock file. This is no longer used.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
suffix String
The name of the lock.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
withLock(FutureOr<void> action(), {String? waiting}) FutureOr<void>
creates a lock file and then calls action once action returns the lock is released. If waiting is passed it will be used to write a log message to the console.

Operators

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