addChild method

void addChild(
  1. TreeElement child
)

Adds child in multiplicity order, adopting it and propagating this element's relevance, enabled state and instance name.

Implementation

void addChild(TreeElement child) {
  if (!isChildable) {
    throw StateError("Can't add children to node that has data value!");
  }
  if (child.multiplicity == TreeReference.indexUnbound) {
    throw StateError('Cannot add child with an unbound index!');
  }
  _children.addInOrder(child);
  child
    ..parent = this
    .._setRelevant(isRelevant, inherited: true)
    ..setEnabled(isEnabled, inherited: true)
    ..instanceName = instanceName;
}