hasPrimaryFocus property

bool get hasPrimaryFocus

Returns true if this node currently has the application-wide input focus.

A FocusNode has the primary focus when the node is focused in its nearest ancestor FocusScopeNode and hasFocus is true for all its ancestor nodes, but none of its descendants.

This is different from hasFocus in that hasFocus is true if the node is anywhere in the focus chain, but here the node has to be at the end of the chain to return true.

A node that returns true for hasPrimaryFocus will be the first node to receive key events through its onKey handler.

This object notifies its listeners whenever this value changes.

Implementation

bool get hasPrimaryFocus => _manager?.primaryFocus == this;