RequestFocusAction class

An Action that requests the focus on the node it is invoked on.

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

Actions.invoke(context, const Intent(RequestFocusAction.key), focusNode: _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 key 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.

However, this RequestFocusAction is the default action associated with the key in the WidgetsApp, and it simply requests focus and has no side effects.

Inheritance

Constructors

RequestFocusAction()
Creates a RequestFocusAction with a fixed key.

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
intentKey LocalKey
The unique key for this action. [...]
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

invoke(FocusNode node, covariant Intent intent) → void
Called when the action is to be performed. [...]
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDiagnosticsNode({String name, DiagnosticsTreeStyle style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel: DiagnosticLevel.info}) String
Returns a string representation of this object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited

Constants

key → const LocalKey
The LocalKey that uniquely identifies this action to an Intent.
ValueKey<Type>(RequestFocusAction)