registerMenu method

  1. @override
Future<void> registerMenu(
  1. MenuItem menu
)

Register a menu entry menu in the toolbox core.

menu is an unstored, internationalized node reflecting a menu entry. The node path is an identifier which should be prefixed with :menu:

  • 'name' The name of the menu to appear (internationalizable)
  • 'tooltip' for the menu (internationalizable)
  • 'help' the help text (internationalizable) Must also provide the action to be triggered.

Implementation

@override
Future<void> registerMenu(MenuItem menu) async {
  ByteSink bout = ByteSink();
  menu.toByteArrayStream(bout);
  bout.close();
  await CommunicationHelper.sendAndWait(
      this,
      Message(
          id,
          GeigerApi.masterId,
          MessageType.registerMenu,
          GeigerUrl(null, GeigerApi.masterId, 'registerMenu'),
          await bout.bytes));
}