The autofocus attribute only takes effect if there isn’t already a focus in
the scope that the node belongs to.

Setting the autofocus attribute on two nodes that belong to different focus
scopes is well defined: each one becomes the focused widget when their
corresponding scopes are focused.

Change notifications

The Focus.onFocusChanged callback can be used to get notifications that the
focus state for a particular node has changed. It notifies if the node is added
to or removed from the focus chain, which means it gets notifications even if it
isn’t the primary focus. If you only want to know if you have received the
primary focus, check and see if hasPrimaryFocus is true on the focus node.

Obtaining the FocusNode

Sometimes, it is useful to obtain the focus node of a Focus widget to
interrogate its attributes.