selection property Null safety

TextSelection selection
final

The range of text that is currently selected.

When selection is a TextSelection that has the same non-negative baseOffset and extentOffset, the selection property represents the caret position.

If the current selection has a negative baseOffset or extentOffset, then the text currently does not have a selection or a caret location, and most text editing operations that rely on the current selection (for instance, insert a character at the caret location) will do nothing.

Implementation

final TextSelection selection;