moveChildren method
Moves children of this node to newParent
.
Implementation
void moveChildren(ContainerNode newParent) {
if (isEmpty) return;
var toBeOptimized = newParent.isEmpty ? null : newParent.last;
while (isNotEmpty) {
var child = first;
child.unlink();
newParent.add(child);
}
/// In case [newParent] already had children we need to make sure
/// combined list is optimized.
if (toBeOptimized != null) toBeOptimized.optimize();
}