selection property

TextHighlight? get selection

Optional source-string span highlight recorded with text paint.

Implementation

TextHighlight? get selection => _selection;
set selection (TextHighlight? value)

Updates the selection value.

A null highlight clears the span. A reversed or negative range throws ArgumentError before the previous highlight is replaced.

Implementation

set selection(TextHighlight? value) {
  final validated = _validatedSelection(value);
  if (_selection == validated) {
    return;
  }
  _selection = validated;
  markNeedsPaint();
}