selection property
The region of text that is selected, if any.
The caret position is represented by a collapsed selection.
If selection is null, there is no selection and attempts to manipulate the selection will throw.
Implementation
TextSelection? get selection => _selection;Implementation
set selection(TextSelection? value) {
  if (_selection == value) {
    return;
  }
  _selection = value;
  _selectionPainter.highlightedRange = value;
  markNeedsPaint();
  markNeedsSemanticsUpdate();
}