of static method

MenuAcceleratorCallbackBinding of(
  1. BuildContext context
)

Returns the active MenuAcceleratorCallbackBinding in the given context, and creates a dependency relationship that will rebuild the context when onInvoke changes.

If no MenuAcceleratorCallbackBinding is found, returns will assert in debug mode and throw an exception in release mode.

See also:

Implementation

static MenuAcceleratorCallbackBinding of(BuildContext context) {
  final MenuAcceleratorCallbackBinding? result = maybeOf(context);
  assert(() {
    if (result == null) {
      throw FlutterError(
        'MenuAcceleratorWrapper.of() was called with a context that does not '
        'contain a MenuAcceleratorWrapper in the given context.\n'
        'No MenuAcceleratorWrapper ancestor could be found in the context that '
        'was passed to MenuAcceleratorWrapper.of(). This can happen because '
        'you are using a widget that looks for a MenuAcceleratorWrapper '
        'ancestor, and do not have a MenuAcceleratorWrapper widget ancestor.\n'
        'The context used was:\n'
        '  $context',
      );
    }
    return true;
  }());
  return result!;
}