maybeOf method Null safety
- 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:
- of for a similar function that will throw if no FocusTraversalGroup ancestor is found.
Implementation
static FocusTraversalPolicy? maybeOf(BuildContext context) {
assert(context != null);
final _FocusTraversalGroupMarker? inherited = context.dependOnInheritedWidgetOfExactType<_FocusTraversalGroupMarker>();
return inherited?.policy;
}