ContextMenuItem class

Represents an action in the context menu.

Each action contains an icon, a label, and a callback function that is triggered when the user taps the action.

Constructors

ContextMenuItem({required IconData icon, required String label, VoidCallback? onTap, List<ContextMenuItem>? subMenu, bool? isDestructive})
Creates a ContextMenuItem item with icon, label, and onTap callback, and optional subMenu.
const

Properties

effectiveIsDestructive bool
no setter
hashCode int
The hash code for this object.
no setterinherited
hasSubMenu bool
no setter
icon IconData
The icon displayed next to the label.
final
isDestructive bool?
Whether this action is destructive (e.g., Delete). If null, it will be inferred from the label.
final
label String
The text label for the menu action.
final
onTap VoidCallback?
The function that is executed when the action is tapped.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
An optional list of sub-menu items.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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