removeAll method

void removeAll()

Removes all children.

Implementation

void removeAll() {
  Iterable<Node>? children = _egg?.nodes;
  if (children == null || children.isEmpty) return;

  // While mounted, removal is deferred to the next flush, so it's safe to
  // iterate the live list. Otherwise, removal is immediate and would
  // mutate the list out from under this loop, so a snapshot is required.
  if (!isMounted) children = children.toList(growable: false);
  for (final child in children) remove(child);
}