insert method

void insert(
  1. ChildType child,
  2. {ChildType? after}
)

Insert child into this render object's child list after the given child.

If after is null, then this inserts the child at the start of the list, and the child becomes the new firstChild.

Implementation

void insert(ChildType child, { ChildType? after }) {
  assert(child != this, 'A RenderObject cannot be inserted into itself.');
  assert(after != this, 'A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.');
  assert(child != after, 'A RenderObject cannot be inserted after itself.');
  assert(child != _firstChild);
  assert(child != _lastChild);
  adoptChild(child);
  _insertIntoChildList(child, after: after);
}