insertNid method

void insertNid(
  1. int index,
  2. int nid
)

Inserts nid at visible position index, shifting the suffix right. nid must be live.

Implementation

void insertNid(int index, int nid) {
  _ensureOrderCapacity(_len + 1);
  // Int32List.setRange uses memmove semantics — overlap-safe even when
  // source and destination are the same buffer.
  _orderNids.setRange(index + 1, _len + 1, _orderNids, index);
  _orderNids[index] = nid;
  _len++;
  _onNidAdded?.call(nid);
  _onMutated();
}