update method
Call this function if you want to update the guard's status. This will also update the persistence delegate if it is not null.
Implementation
@mustCallSuper
Future<bool> update({required bool isSatisfied}) async {
_notifier.add(isSatisfied);
if (isSatisfied == _currentStatus) {
return _currentStatus; // No change, return current status
}
_currentStatus = isSatisfied;
if (persistenceDelegate != null) {
await persistenceDelegate!.updateGuardStatus(
guardIdentifier,
isSatisfied,
);
}
return isSatisfied;
}