FocusManager class

Manages the focus tree.

The focus tree keeps track of which FocusNode is the user's current keyboard focus. The widget that owns the FocusNode often listens for keyboard events.

The focus manager is responsible for holding the FocusScopeNode that is the root of the focus tree and tracking which FocusNode has the overall focus.

The FocusManager is held by the WidgetsBinding as WidgetsBinding.focusManager. The FocusManager is rarely accessed directly. Instead, to find the FocusScopeNode for a given BuildContext, use FocusScope.of.

The FocusManager knows nothing about FocusNodes other than the one that is currently focused. If a FocusScopeNode is removed, then the FocusManager will attempt to focus the next FocusScopeNode in the focus tree that it maintains, but if the current focus in that FocusScopeNode is null, it will stop there, and no FocusNode will have focus.

See also:


Creates an object that manages the focus tree. [...]


rootScope FocusScopeNode
The root FocusScopeNode in the focus tree. [...]
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


toString() String
Returns a string representation of this object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]


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