selection property
TextSelection
get
selection
The current text selection in the editor.
For a cursor with no selection, TextSelection.isCollapsed will be true.
Implementation
TextSelection get selection => _selection;
set
selection
(TextSelection newSelection)
Sets the current text selection.
Setting this property will update the selection and notify listeners.
For a collapsed cursor, use TextSelection.collapsed(offset: pos).
Implementation
set selection(TextSelection newSelection) {
if (_selection == newSelection) return;
_flushBuffer();
_selection = newSelection;
selectionOnly = true;
_isTyping = false;
_imeProjectionDirty = true;
_scheduleSyncToConnection();
notifyListeners();
}