splitAt method

EasyText? splitAt(
  1. int index
)

Splits this EasyText at specified offset

Returns the inserted EasyText object

Implementation

EasyText? splitAt(int index) {
  assert(
      index >= 0 && index <= length,
      'offset $index does '
      'not satisfy the range '
      'of this text => 0 to $length');
  if (index == 0) return this;
  if (index == length) return isLast ? null : next;

  final EasyText split = EasyText(
    text: after(index),
    styles: styles.copy(),
  );
  text = before(index);
  insertAfter(split);
  return split;
}