moveChildren method
Moves children of this node to newParent
.
Implementation
void moveChildren(ContainerNode? newParent) {
if (isEmpty) return;
T? toBeOptimized = newParent!.isEmpty ? null : newParent.last as T?;
while (isNotEmpty) {
T child = first as T;
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();
}