insert method

BidiRope insert(
  1. int index,
  2. String text
)

Implementation

BidiRope insert(int index, String text) {
  if (index < 0 || index > length) {
    throw RangeError.range(index, 0, length, 'index');
  }

  if (text.isEmpty) {
    return this;
  }

  final newRope = _rope.insert(index, text);
  final newText = newRope.toString();
  final containsRtl = BidirectionalText.containsRtl(newText);

  return BidiRope._(newRope, containsRtl);
}