debugUnlockDelegate method Null safety

  1. @override
bool debugUnlockDelegate(
  1. BuildContext context
)
override

This is called by PlatformMenuBar when it is disposed, so that another one can take over.

If the debugUnlockDelegate successfully unlocks the delegate, it will return true.

See also:

Implementation

@override
bool debugUnlockDelegate(BuildContext context) {
  assert(() {
    // It's OK to unlock if the lock isn't set, but not OK if a different
    // context is unlocking it.
    if (_lockedContext != null && _lockedContext != context) {
      return false;
    }
    _lockedContext = null;
    return true;
  }());
  return true;
}