dispatch static method

void dispatch(
  1. String id
)

What a native binding calls when an item is chosen.

An id that is not in the current menu is ignored rather than an error: a binding can report an item from a menu that has since been replaced.

Implementation

static void dispatch(String id) {
  if (!_ids.contains(id)) return;
  _onSelected?.call(id);
  _selected.add(id);
}