insert method
Insert text
at specified character index
with style style
.
Implementation
@override
void insert(int index, String value, NotusStyle? style) {
assert(index >= 0 && (index <= length), 'Index: $index, Length: $length.');
assert(value.isNotEmpty);
final node = LeafNode(value);
if (index == length) {
insertAfter(node);
} else {
splitAt(index)!.insertBefore(node);
}
node.formatAndOptimize(style);
}