insert method

  1. @override
void insert(
  1. int position,
  2. Bs4Element element
)

It is just like append, except the new element does not necessarily go at the end of its parent’s .contents. It’ll be inserted at whatever numeric position you say, just after the opening tag of the current element.

If the position is out of range, throws RangeError.

If you want to pass Node instead Bs4Element, you can do it via bs4element.element.insert(index, node).

Implementation

@override
void insert(int position, Bs4Element element) =>
    _element.nodes.insert(position, element._element);