NamedLock class

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

Constructors

NamedLock({required String name, String description = '', String suffix = 'dcli.lck', Duration timeout = const Duration(days: 1)})
All code that shares the lock MUST use the same name and suffix.

Properties

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

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