insertText method
Inserts text at the cursor position, replacing any selection first.
Implementation
void insertText(String text) {
if (hasSelection) {
deleteSelection();
}
_text = _text.substring(0, _cursorPosition) +
text +
_text.substring(_cursorPosition);
_cursorPosition += text.length;
notifyListeners();
}