updateSelection method

void updateSelection(
  1. TextSelection newSelection
)

Update the active selection range

Implementation

void updateSelection(TextSelection newSelection) {
  final base = newSelection.baseOffset.clamp(0, _text.length);
  final extent = newSelection.extentOffset.clamp(0, _text.length);

  _selection = newSelection.copyWith(baseOffset: base, extentOffset: extent);
  notifyListeners();
}