showContextMenu function

Future<MenuItem?> showContextMenu(
  1. ShowMenuArgs args
)

Implementation

Future<MenuItem?> showContextMenu(ShowMenuArgs args) async {
  final menu = _buildMenu(args.items);
  _menuItemId = 0;

  _channel.invokeMethod(_kShowMenu, args.toJson());

  final id = await _contextMenuCompleter.future;
  _contextMenuCompleter = Completer<int?>();

  return menu[id];
}