depthFirstIterateChildren method

  1. @visibleForTesting
List<Layer> depthFirstIterateChildren()

Returns the descendants of this layer in depth first order.

Implementation

@visibleForTesting
List<Layer> depthFirstIterateChildren() {
  if (firstChild == null) {
    return <Layer>[];
  }
  final List<Layer> children = <Layer>[];
  Layer? child = firstChild;
  while (child != null) {
    children.add(child);
    if (child is ContainerLayer) {
      children.addAll(child.depthFirstIterateChildren());
    }
    child = child.nextSibling;
  }
  return children;
}