changedScope method

  1. @override
void changedScope(
  1. {FocusNode? node,
  2. FocusScopeNode? oldScope}
)
override

This is called whenever the given node is re-parented into a new scope, so that the policy has a chance to update or invalidate any cached data that it maintains per scope about the node.

The oldScope is the previous scope that this node belonged to, if any.

The default implementation does nothing.

Implementation

@override
void changedScope({FocusNode? node, FocusScopeNode? oldScope}) {
  super.changedScope(node: node, oldScope: oldScope);
  if (oldScope != null) {
    _policyData[oldScope]?.history.removeWhere((_DirectionalPolicyDataEntry entry) {
      return entry.node == node;
    });
  }
}