invokeAction method

bool invokeAction (
  1. Action action,
  2. Intent intent,
  3. {FocusNode focusNode}
)

Invokes the given action, optionally without regard for the currently focused node in the focus tree.

Actions invoked will receive the given focusNode, or the FocusManager.primaryFocus if the given focusNode is null.

The action and intent arguments must not be null.

Returns true if the action was successfully invoked.

Implementation

bool invokeAction(Action action, Intent intent, {FocusNode focusNode}) {
  assert(action != null);
  assert(intent != null);
  focusNode ??= primaryFocus;
  if (action != null && intent.isEnabled(focusNode.context)) {
    action.invoke(focusNode, intent);
    return true;
  }
  return false;
}