PopupMenuOption constructor

PopupMenuOption({
  1. required dynamic onTap(),
  2. required Widget icon,
  3. Widget? child,
  4. String? label,
})

Creates a PopupMenuOption.

The onTap and icon parameters are required. At least one of child or label must be provided to represent the content of the menu option.

Example:

PopupMenuOption(
  icon: Icon(Icons.edit),
  label: 'Edit',
  onTap: () {
    // Handle edit action
  },
)

Implementation

PopupMenuOption({
  required this.onTap,
  required this.icon,
  this.child,
  this.label,
}) : assert(child != null || label != null, 'child or label is required');