delete method

  1. @override
void delete(
  1. int index,
  2. int? len
)
override

Implementation

@override
void delete(int index, int? len) {
  assert(index < length);

  final local = math.min(length - index, len!);
  final target = _isolate(index, local);
  final prev = target.previous as Leaf?;
  final next = target.next as Leaf?;
  target.unlink();

  final remain = len - local;
  if (remain > 0) {
    assert(next != null);
    next!.delete(0, remain);
  }

  if (prev != null) {
    prev.adjust();
  }
}