isLocked property
Indicates whether the protect is currently locked.
Implementation
static FutureOr<bool> get isLocked async {
// Web Locks API is unavailable for some reason, so proceed without it.
if (!_locksAvailable()) {
return false;
}
bool held = false;
try {
final locks = (await _getLocks().toDart) as JSArray;
held =
locks.toDart
.map((e) => e?.dartify() as Map?)
.any((e) => e?['name'] == 'mutex') ==
true;
} catch (e) {
held = false;
}
return _guards['mutex']?.isLocked == true || held;
}