insert method Null safety

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.


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);
  _insertIntoChildList(child, after: after);