maybeOfNode static method

FocusTraversalPolicy? maybeOfNode(
  1. FocusNode node

Returns the FocusTraversalPolicy that applies to the nearest ancestor of the given FocusNode.

Will return null if no FocusTraversalPolicy ancestor applies to the given FocusNode.

The FocusTraversalPolicy is set by introducing a FocusTraversalGroup into the widget tree, which will associate a policy with the focus tree under the nearest ancestor Focus widget.

This function differs from maybeOf in that it takes a FocusNode and only traverses the focus tree to determine the policy in effect. Unlike this function, the maybeOf function takes a BuildContext and first walks up the widget tree to find the nearest ancestor Focus or FocusScope widget, and then calls this function with the focus node associated with that widget to determine the policy in effect.


static FocusTraversalPolicy? maybeOfNode(FocusNode node) {
  return _getGroupNode(node)?.policy;