RequestFocusAction class

An Action that requests the focus on the node it is given in its RequestFocusIntent.

This action can be used to request focus for a particular node, by calling Action.invoke like so:

Actions.invoke(context, RequestFocusIntent(focusNode));

Where the focusNode is the node for which the focus will be requested.

The difference between requesting focus in this way versus calling FocusNode.requestFocus directly is that it will use the Action registered in the nearest Actions widget associated with RequestFocusIntent to make the request, rather than just requesting focus directly. This allows the action to have additional side effects, like logging, or undo and redo functionality.

This RequestFocusAction class is the default action associated with the RequestFocusIntent in the WidgetsApp. It requests focus. You can redefine the associated action with your own Actions widget.

See FocusTraversalPolicy for more information about focus traversal.





callingAction Action<RequestFocusIntent>?
The Action overridden by this Action.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
intentType Type
Gets the type of intent this action responds to.
no setterinherited
isActionEnabled bool
Whether this Action is inherently enabled.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


addActionListener(ActionListenerCallback listener) → void
Register a callback to listen for changes to the state of this action.
consumesKey(RequestFocusIntent intent) bool
Indicates whether this action should treat key events mapped to this action as being "handled" when it is invoked via the key event.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
invoke(RequestFocusIntent intent) → void
Called when the action is to be performed.
isEnabled(RequestFocusIntent intent) bool
Returns true if the action is enabled and is ready to be invoked.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
notifyActionListeners() → void
Call all the registered listeners.
removeActionListener(ActionListenerCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
toKeyEventResult(RequestFocusIntent intent, covariant Object? invokeResult) KeyEventResult
Converts the result of invoke of this action to a KeyEventResult.
toString({DiagnosticLevel minLevel =}) String
A string representation of this object.
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.


operator ==(Object other) bool
The equality operator.