copyNodeAt method

TreeReference copyNodeAt(
  1. TreeReference from,
  2. TreeReference to
)

Copies the element at from to to (a new repeat instance); returns the new element's reference.

Implementation

TreeReference copyNodeAt(TreeReference from, TreeReference to) {
  if (!from.isAbsolute) {
    throw InvalidReferenceException(
      'Source reference must be absolute for copying',
      from,
    );
  }
  final source = resolveReference(from);
  if (source == null) {
    throw InvalidReferenceException(
      'Null Source reference while attempting to copy node',
      from,
    );
  }
  return copyNode(source, to).ref;
}