select method

void select(
  1. MenuItem item,
  2. MenuItemGroup group
)

Implementation

void select(MenuItem item, MenuItemGroup group) {
  item.action?.call();

  // Fire the event for activating the menu item. This does not mean the item
  // is selected, but merely that it was triggered (by mouse, keyboard, w/e).
  _selected.add(item);

  // If the item is in a multi-select group, keep the menu open so the user
  // can select multiple items.
  if (group is! MenuItemGroupWithSelection ||
      (group as MenuItemGroupWithSelection).shouldCloseMenuOnSelection) {
    _menuRoot?.closeHierarchy();
  }
}