enclosingScope property

FocusScopeNode enclosingScope

Returns the nearest enclosing scope node above this node, or null if the node has not yet be added to the focus tree.

If this node is itself a scope, this will only return ancestors of this scope.

Use nearestScope to start at this node instead of above it.

Implementation

FocusScopeNode get enclosingScope {
  return ancestors.firstWhere((FocusNode node) => node is FocusScopeNode, orElse: () => null) as FocusScopeNode;
}