invoke method

  1. @override
void invoke(
  1. covariant AppBarBuildIntent intent
)
override

Called when the action is to be performed.

This is called by the ActionDispatcher when an action is invoked via Actions.invoke, or when an action is invoked using ActionDispatcher.invokeAction directly.

This method is only meant to be invoked by an ActionDispatcher, or by its subclasses, and only when isEnabled is true.

When overriding this method, the returned value can be any Object, but changing the return type of the override to match the type of the returned value provides more type safety.

For instance, if an override of invoke returned an int, then it might be defined like so:

class IncrementIntent extends Intent {
  const IncrementIntent({required this.index});

  final int index;
}

class MyIncrementAction extends Action<IncrementIntent> {
  @override
  int invoke(IncrementIntent intent) {
    return intent.index + 1;
  }
}

To receive the result of invoking an action, it must be invoked using Actions.invoke, or by invoking it using an ActionDispatcher. An action invoked via a Shortcuts widget will have its return value ignored.

If the action's behavior depends on a BuildContext, subclass ContextAction instead of Action.

Implementation

@override
void invoke(covariant AppBarBuildIntent intent) {
  this.appbar.value = intent.appbar;
}