moveChildToNewParent method

void moveChildToNewParent(
  1. QuillContainer<Node?>? newParent
)
inherited

Moves children of this node to newParent.

Implementation

void moveChildToNewParent(QuillContainer? newParent) {
  if (isEmpty) {
    return;
  }

  final last = newParent!.isEmpty ? null : newParent.last as T?;
  while (isNotEmpty) {
    final 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 (last != null) last.adjust();
}