hasFocus property

bool hasFocus

Whether this node has the overall focus.

A FocusNode has the overall focus when the node is focused in its parent FocusScopeNode and FocusScopeNode.isFirstFocus is true for that scope and all its ancestor scopes.

To request focus, find the FocusScopeNode for the current BuildContext and call the FocusScopeNode.requestFocus method:

FocusScope.of(context).requestFocus(focusNode);

This object notifies its listeners whenever this value changes.

Implementation

bool get hasFocus => _manager?._currentFocus == this;