removeAll method Null safety

void removeAll()

Remove all their children from this render object's child list.

More efficient than removing them individually.

Implementation

void removeAll() {
  ChildType? child = _firstChild;
  while (child != null) {
    final ParentDataType childParentData = child.parentData! as ParentDataType;
    final ChildType? next = childParentData.nextSibling;
    childParentData.previousSibling = null;
    childParentData.nextSibling = null;
    dropChild(child);
    child = next;
  }
  _firstChild = null;
  _lastChild = null;
  _childCount = 0;
}