setContextMenu method

Future<void> setContextMenu(
  1. List<MenuItemBase> menus
)

Sets the native application menu to menus.

How exactly this is handled is subject to platform interpretation. For instance, special menus that are handled entirely on the native side might be added to the provided menus.

Implementation

Future<void> setContextMenu(List<MenuItemBase> menus) async {
  try {
    _updateInProgress = true;
    await _platformChannel.invokeMethod(
        _kSetContextMenu, _channelRepresentationForMenus(menus));
    _updateInProgress = false;
  } on PlatformException catch (e) {
    debugPrint('Platform exception setting menu: ${e.message}');
  }
}