insertText method
Implementation
void insertText(String text, {int? positionAt}) {
final insertPos = (positionAt ?? selection.end).clamp(0, this.text.length);
final curChars = this.text.characters.toList();
if (insertPos == this.text.length) {
curChars.add(text);
} else {
curChars.insert(insertPos, text);
}
this.text = curChars.join('');
setCursorPosition(position: insertPos + text.length);
}