updateSubtreeNeedsAddToScene method

  1. @override
void updateSubtreeNeedsAddToScene()
override

Traverses the layer subtree starting from this layer and determines whether it needs addToScene.

A layer needs addToScene if any of the following is true:

ContainerLayer overrides this method to recursively call it on its children.

Implementation

@override
void updateSubtreeNeedsAddToScene() {
  super.updateSubtreeNeedsAddToScene();
  Layer? child = firstChild;
  while (child != null) {
    child.updateSubtreeNeedsAddToScene();
    _needsAddToScene = _needsAddToScene || child._needsAddToScene;
    child = child.nextSibling;
  }
}