toKeyEventResult method

KeyEventResult toKeyEventResult(
  1. T intent,
  2. covariant Object? invokeResult
)

Converts the result of invoke of this action to a KeyEventResult.

This is typically used when the action is invoked in response to a keyboard shortcut.

The invokeResult argument is the value returned by the invoke method.

By default, calls consumesKey and converts the returned boolean to KeyEventResult.handled if it's true, and KeyEventResult.skipRemainingHandlers if it's false.

Concrete implementations may refine the type of invokeResult, since they know the type returned by invoke.

Implementation

KeyEventResult toKeyEventResult(T intent, covariant Object? invokeResult) {
  return consumesKey(intent)
    ? KeyEventResult.handled
    : KeyEventResult.skipRemainingHandlers;
}