insertNodes method

void insertNodes(
  1. Path path,
  2. Iterable<Node> nodes, {
  3. bool deepCopy = true,
})

Inserts a sequence of Nodes at the given Path.

Implementation

void insertNodes(
  Path path,
  Iterable<Node> nodes, {
  bool deepCopy = true,
}) {
  if (nodes.isEmpty) {
    return;
  }
  if (deepCopy) {
    // add `toList()` to prevent the redundant copy of the nodes when looping
    nodes = nodes.map((e) => e.copyWith()).toList();
  }
  add(
    InsertOperation(
      path,
      nodes,
    ),
  );
}