addChild method

void addChild(
  1. RenderNode parentNode,
  2. RenderNode childNode,
  3. int index
)

Implementation

void addChild(RenderNode parentNode, RenderNode childNode, int index) {
  var childViewModel = childNode.renderViewModel;
  var parentViewModel = parentNode.renderViewModel;

  if (parentViewModel is GroupViewModel) {
    parentViewModel.addViewModel(childViewModel, index);
  } else {
    Error exception = StateError(
      "${"child null or parent not ViewGroup pid ${parentNode.id}"} parentClass ${parentNode.name} renderNodeClass ${childNode.name}${" id ${childNode.id}"}",
    );
    _context.handleNativeException(exception, true);
  }
}