shift method
Return the resulting span after inserting source text at index
with length
.
Implementation
AttributeSpan shift(int index, int length) {
if (isFixed ||
index > end ||
(index == end && attribute.expandRules.end != ExpandRule.inclusive)) {
return this;
}
final newEnd = end + length;
if (index > start ||
(index == start &&
attribute.expandRules.start == ExpandRule.inclusive)) {
return copyWith(end: newEnd);
}
final newStart = start + length;
return copyWith(start: newStart, end: newEnd);
}