insertAfter method

int insertAfter(
  1. IndexedNode after,
  2. IndexedNode element
)
override

Insert an element in the children list after the node after

Implementation

int insertAfter(IndexedNode after, IndexedNode element) {
  final index = children.indexWhere((node) => node.key == after.key);
  if (index < 0) throw NodeNotFoundException.fromNode(after);
  insert(index + 1, element);
  return index + 1;
}