setSelectionImmediately method
Implementation
void setSelectionImmediately(TextSelection newSelection) {
if (_selection == newSelection) return;
if (isComposingActive) {
newSelection = _commitCompositionAndRemapSelection(newSelection);
requestImeReset?.call();
}
_pendingSelectionReplacement = null;
_flushBuffer();
final textLength = length;
final clampedBase = newSelection.baseOffset.clamp(0, textLength);
final clampedExtent = newSelection.extentOffset.clamp(0, textLength);
newSelection = newSelection.copyWith(
baseOffset: clampedBase,
extentOffset: clampedExtent,
);
_selection = newSelection;
selectionOnly = true;
_isTyping = false;
_imeProjectionDirty = true;
_syncToConnection();
notifyListeners();
}