TextSelection class

A range of text that represents a selection.

Inheritance
Annotations
  • @immutable

Constructors

TextSelection({@required int baseOffset, @required int extentOffset, TextAffinity affinity: TextAffinity.downstream, bool isDirectional: false })
Creates a text selection. [...]
const
TextSelection.collapsed({@required int offset, TextAffinity affinity: TextAffinity.downstream })
Creates a collapsed selection at the given offset. [...]
const
TextSelection.fromPosition(TextPosition position)
Creates a collapsed selection at the given text position. [...]

Properties

affinity TextAffinity
If the text range is collapsed and has more than one visual location (e.g., occurs at a line break), which of the two locations to use when painting the caret.
final
base TextPosition
The position at which the selection originates. [...]
read-only
baseOffset int
The offset at which the selection originates. [...]
final
extent TextPosition
The position at which the selection terminates. [...]
read-only
extentOffset int
The offset at which the selection terminates. [...]
final
hashCode int
The hash code for this object. [...]
read-only, override
isDirectional bool
Whether this selection has disambiguated its base and extent. [...]
final
end int
The next index after the characters in this range. [...]
final, inherited
isCollapsed bool
Whether this range is empty (but still potentially placed inside the text).
read-only, inherited
isNormalized bool
Whether the start of this range precedes the end.
read-only, inherited
isValid bool
Whether this range represents a valid position in the text.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
start int
The index of the first character in the range. [...]
final, inherited

Methods

copyWith({int baseOffset, int extentOffset, TextAffinity affinity, bool isDirectional }) TextSelection
Creates a new TextSelection based on the current selection, with the provided parameters overridden.
toString() String
Returns a string representation of this object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
textAfter(String text) String
The text after this range.
inherited
textBefore(String text) String
The text before this range.
inherited
textInside(String text) String
The text inside this range.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
override