invoke<T extends Intent> method

Object? invoke<T extends Intent>(
  1. T intent
)

Invokes the action associated with the given Intent using the Actions widget that most tightly encloses the given BuildContext.

This method returns the result of invoking the action's Action.invoke method. If the given intent doesn't map to an action, then it will look to the next ancestor Actions widget in the hierarchy until it reaches the root. This method will throw an exception if no ambient Actions widget is found, or when a suitable Action is found but it returns false for Action.isEnabled.

Example:

Object? maybeResult = context.invoke(SomeIntent());

Implementation

Object? invoke<T extends Intent>(T intent) => Actions.invoke(this, intent);