insert method
Insert text at the cursor position (replaces selection if one exists)
Implementation
void insert(String insertion) {
if (!_selection.isCollapsed) {
_deleteSelectionInternal();
}
final currentOffset = _selection.baseOffset;
final before = _text.substring(0, currentOffset);
final after = _text.substring(currentOffset);
_text = before + insertion + after;
_selection = TextSelection.collapsed(
offset: currentOffset + insertion.length,
);
_reparse();
notifyListeners();
}