removeAllChildren method Null safety

void removeAllChildren ()

Removes all of this layer's children from its child list.

Implementation

void removeAllChildren() {
  Layer? child = firstChild;
  while (child != null) {
    final Layer? next = child.nextSibling;
    child._previousSibling = null;
    child._nextSibling = null;
    assert(child.attached == attached);
    dropChild(child);
    child = next;
  }
  _firstChild = null;
  _lastChild = null;
}