removeRange method

RgaList<T> removeRange(
  1. int index,
  2. int count
)

Tombstones count visible elements starting at index.

Implementation

RgaList<T> removeRange(int index, int count) {
  final visible = _visible();
  if (index < 0 || count < 0 || index + count > visible.length) {
    throw RangeError.range(index + count, 0, visible.length, 'index+count');
  }
  final nodes = Map<String, RgaNode<T>>.from(_nodes);
  for (var i = index; i < index + count; i++) {
    nodes[visible[i].id] = visible[i].tombstone();
  }
  return RgaList._(replicaId, nodes, _counter);
}