maybeInvoke<T extends Intent> method

Object? maybeInvoke<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 no action mapping was found for the specified intent, or if the first action found was disabled, or the action itself returns null from Action.invoke, then this method returns null. 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. If a suitable Action is found but its Action.isEnabled returns false, the search will stop and this method will return null.

Example:

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

Implementation

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