removeAny static method

void removeAny()

Remove the currently shown context menu from the UI.

Does nothing if no context menu is currently shown.

If a menu is removed, and that menu provided an onRemove callback when it was created, then that callback will be called.

See also:

  • remove, which removes only the current instance.

Implementation

static void removeAny() {
  _menuOverlayEntry?.remove();
  _menuOverlayEntry?.dispose();
  _menuOverlayEntry = null;
  if (_shownInstance != null) {
    _shownInstance!.onRemove?.call();
    _shownInstance = null;
  }
}