insertBefore method Null safety

void insertBefore(
  1. Node node,
  2. Node? refNode
)

Insert node as a child of the current node, before refNode in the

Implementation

void insertBefore(Node node, Node? refNode) {
  if (refNode == null) {
    nodes.add(node);
  } else {
    nodes.insert(nodes.indexOf(refNode), node);
  }
}