insertAllBefore method Null safety

void insertAllBefore (
  1. Iterable<Node> newNodes,
  2. Node refChild
)

Inserts all of the nodes into this node directly before refChild.

See also:

Implementation

void insertAllBefore(Iterable<Node> newNodes, Node refChild) {
  if (newNodes is _ChildNodeListLazy) {
    _ChildNodeListLazy otherList = newNodes;
    if (identical(otherList._this, this)) {
      throw new ArgumentError(newNodes);
    }

    // Optimized route for copying between nodes.
    for (var i = 0, len = otherList.length; i < len; ++i) {
      this.insertBefore(otherList._this.firstChild!, refChild);
    }
  } else {
    for (var node in newNodes) {
      this.insertBefore(node, refChild);
    }
  }
}