selection property

TextSelection get selection

The current selection.

Implementation

TextSelection get selection => TextSelection(
  baseOffset: _model.selectionStart ?? _model.position,
  extentOffset: _model.selectionEnd ?? _model.position,
);
set selection (TextSelection value)

Sets the selection and notifies listeners.

Implementation

set selection(TextSelection value) {
  if (selection == value) return;
  if (value.isCollapsed) {
    _model.selectionStart = null;
    _model.selectionEnd = null;
  } else {
    _model.selectionStart = value.baseOffset;
    _model.selectionEnd = value.extentOffset;
  }
  _model.position = value.extentOffset;
  notifyListeners();
}