depthFirstIterateChildren method Null safety

  1. @visibleForTesting
List<Layer> depthFirstIterateChildren()
visibleForTesting">@visibleForTesting

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;
}