deleteBackward method

void deleteBackward()

Deletes the character before the cursor (backspace).

Implementation

void deleteBackward() {
  if (hasSelection) {
    deleteSelection();
    return;
  }
  if (_cursorPosition > 0) {
    _text = _text.substring(0, _cursorPosition - 1) +
        _text.substring(_cursorPosition);
    _cursorPosition--;
    notifyListeners();
  }
}