maybeOf method Null safety

FocusTraversalPolicy? maybeOf(
  1. BuildContext context
)

Returns the focus policy set by the FocusTraversalGroup that most tightly encloses the given BuildContext.

It does not create a rebuild dependency because changing the traversal order doesn't change the widget tree, so nothing needs to be rebuilt as a result of an order change.

Will return null if it doesn't find a FocusTraversalGroup ancestor.

See also:

Implementation

static FocusTraversalPolicy? maybeOf(BuildContext context) {
  assert(context != null);
  final _FocusTraversalGroupMarker? inherited = context.dependOnInheritedWidgetOfExactType<_FocusTraversalGroupMarker>();
  return inherited?.policy;
}