insertBefore method

int insertBefore(
  1. IndexedNode before,
  2. IndexedNode element
)
override

Insert an element in the children list before the node before

Implementation

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