addChild method

void addChild(
  1. NodeV2 node, [
  2. int? position
])

adds a child-node to this node at an optional position. Triggers a recalc of node indices

Implementation

void addChild(NodeV2 node, [int? position]) {
  if (position == null) {
    children.add(node);
  } else {
    children.insert(position, node);
  }

  _recalcIndices();
}