MenuItem class Null safety

An abstract class for describing cascading menu hierarchies that are part of a PlatformMenuBar.

This type is also used by PlatformMenuDelegate.setMenus to accept the menu hierarchy to be sent to the platform, and by PlatformMenuBar to define the menu hierarchy.

This class is abstract, and so can't be used directly. Typically subclasses like PlatformMenuItem are used.

See also:

  • PlatformMenuBar, a widget that renders menu items using platform APIs instead of Flutter.
Mixed in types
Implementers

Constructors

Allows subclasses to have const constructors.
const

Properties

descendants List<MenuItem>
Returns all descendant MenuItems of this item.
read-only
hashCode int
The hash code for this object.
read-only, inherited
members List<MenuItem>
Returns the list of group members if this menu item is a "grouping" menu item, such as PlatformMenuItemGroup.
read-only
Returns any child MenuItems of this item.
read-only
onClose VoidCallback?
Returns a callback, if any, to be invoked if the platform menu receives a "Menu.closed" method call from the platform for this item.
read-only
onOpen VoidCallback?
Returns a callback, if any, to be invoked if the platform menu receives a "Menu.opened" method call from the platform for this item.
read-only
onSelected VoidCallback?
Returns a callback, if any, to be invoked if the platform menu receives a "Menu.selectedCallback" method call from the platform for this item.
read-only
onSelectedIntent Intent?
Returns an intent, if any, to be invoked if the platform receives a "Menu.selectedCallback" method call from the platform for this item.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
shortcut MenuSerializableShortcut?
The optional shortcut that selects this MenuItem.
read-only

Methods

debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
@mustCallSuper, @protected, inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toChannelRepresentation(PlatformMenuDelegate delegate, {required MenuItemSerializableIdGenerator getId}) Iterable<Map<String, Object?>>
Converts the representation of this item into a map suitable for sending over the default "flutter/menu" channel used by DefaultPlatformMenuDelegate.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

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