MethodChannelMacMenuBar class

The method channel implementation of MacMenuBarPlatform.

This class implements the platform interface using platform channels to communicate with the native platform code. It handles the method channel communication and manages the callbacks for menu actions.

This class should not be instantiated directly. Instead, access it through MacMenuBarPlatform.instance.

Inheritance

Constructors

MethodChannelMacMenuBar()
Constructs a MethodChannelMacMenuBar and sets up the method call handler.

Properties

hashCode int
The hash code for this object.
no setterinherited
methodChannel MethodChannel
The method channel used to communicate with the native platform.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addMenuItem({required String menuId, required String itemId, required String title, int? index, SingleActivator? shortcut, bool enabled = true}) Future<bool>
Adds a menu item to the specified menu.
override
addSubmenu({required String parentMenuId, required String submenuId, required String title, int? index}) Future<bool>
Adds a submenu to the specified parent menu.
override
handleMethodCall(MethodCall call) Future
Handles method calls from the native platform.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeMenuItem(String itemId) Future<bool>
Removes a menu item by its ID.
override
setMenuItemEnabled(String itemId, bool enabled) Future<bool>
Sets a menu item's enabled state.
override
setMenuItemSelectedHandler(MenuItemSelectedHandler handler) → void
Sets the callback handler for custom menu item selections.
override
setOnCopyFromMenu(Future<bool> callback()?) → void
Sets the callback to be invoked when the Copy menu item is selected.
override
setOnCutFromMenu(Future<bool> callback()?) → void
Sets the callback to be invoked when the Cut menu item is selected.
override
setOnPasteFromMenu(Future<bool> callback()?) → void
Sets the callback to be invoked when the Paste menu item is selected.
override
setOnSelectAllFromMenu(Future<bool> callback()?) → void
Sets the callback to be invoked when the Select All menu item is selected.
override
toString() String
A string representation of this object.
inherited
updateMenuItem({required String itemId, String? title, bool? enabled}) Future<bool>
Updates a menu item's properties.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited