canLock property

  1. @override
bool get canLock
override

Whether calling synchronized right now would be able to acquire the lock without waiting.

For a basic (non-reentrant) or reentrant lock, this is the same as !locked (or, inside a reentrant lock's own zone, whether the current nesting level is free). For a MultiLock, this is true only when every underlying lock can be acquired.

Implementation

@override
bool get canLock => !locked;