isEnabled method Null safety
- PrioritizedIntents intent
override
Returns true if the action is enabled and is ready to be invoked.
This will be called by the ActionDispatcher before attempting to invoke the action.
Implementation
@override
bool isEnabled(PrioritizedIntents intent) {
final FocusNode? focus = primaryFocus;
if (focus == null || focus.context == null) {
return false;
}
for (final Intent candidateIntent in intent.orderedIntents) {
final Action<Intent>? candidateAction = Actions.maybeFind<Intent>(
focus.context!,
intent: candidateIntent,
);
if (candidateAction != null && candidateAction.isEnabled(candidateIntent)) {
_selectedAction = candidateAction;
_selectedIntent = candidateIntent;
return true;
}
}
return false;
}