visitChildren method

  1. @override
void visitChildren(
  1. ElementVisitor visitor
)
override

Calls the argument for each child. Must be overridden by subclasses that support having children.

There is no guaranteed order in which the children will be visited, though it should be consistent over time.

Calling this during build is dangerous: the child list might still be being updated at that point, so the children might not be constructed yet, or might be old children that are going to be replaced. This method should only be called if it is provable that the children are available.

Implementation

@override
void visitChildren(ElementVisitor visitor) {
  for (final Element child in _children) {
    if (!_forgottenChildren.contains(child)) {
      visitor(child);
    }
  }
}