appendChild method

  1. @override
  2. @mustCallSuper
Node appendChild(
  1. Node child
)
override

Implementation

@override
@mustCallSuper
Node appendChild(Node child) {
  super.appendChild(child);
  // Update renderStyle tree.
  if (child is Element) {
    child.renderStyle.parent = renderStyle;
  }

  RenderLayoutBox? renderLayoutBox = _renderLayoutBox;
  if (isRendererAttached) {
    // Only append child renderer when which is not attached.
    if (!child.isRendererAttached && renderLayoutBox != null && this is! WidgetElement) {
      RenderBox? after;
      RenderLayoutBox? scrollingContentBox = renderLayoutBox.renderScrollingContent;
      if (scrollingContentBox != null) {
        after = scrollingContentBox.lastChild;
      } else {
        after = renderLayoutBox.lastChild;
      }

      child.attachTo(this, after: after);
    }
  }

  return child;
}