insertNode method
Implementation
Node insertNode(int index, Node node) {
final childNodes = this.childNodes;
if (index >= childNodes.length) {
return appendChild(node);
} else if (index == 0) {
var child0 = firstChild;
if (child0 == null) {
return appendChild(node);
} else {
return insertBefore(node, child0);
}
} else {
var child = childNodes.item(index)!;
return insertBefore(node, child);
}
}