unregisterMenuKey method

void unregisterMenuKey(
  1. String index
)

取消注册菜单项的 GlobalKey

这个方法在菜单项销毁时调用,从管理器中移除 GlobalKey 注意:在某些情况下(如切换应用),我们可能希望保留 GlobalKey 直到统一清除

@param index 要取消注册的菜单项索引

Implementation

void unregisterMenuKey(String index) {
  try {
    unawaited(DencendLogger.debug('取消注册菜单项 GlobalKey: index=$index'));
    _menuKeys.remove(index);
  } on Exception catch (e) {
    unawaited(DencendLogger.debug('取消注册 GlobalKey 失败: $e'));
  }
}