A range of text that represents a selection.

Inheritance

Constructors

TextSelection({int baseOffset, int extentOffset, TextAffinity affinity: TextAffinity.downstream, bool isDirectional: false })

Creates a text selection.

const
TextSelection.collapsed({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 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.

read-only
base → TextPosition

The position at which the selection originates.

read-only
baseOffset → int

The offset at which the selection originates.

read-only
extent → TextPosition

The position at which the selection terminates.

read-only
extentOffset → int

The offset at which the selection terminates.

read-only
hashCode → int

read-only
isDirectional → bool

Whether this selection has disambiguated its base and extent.

read-only
end → int

The next index after the characters in this range.

read-only, 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.

read-only, inherited

Operators

operator ==(other) → bool

The equality operator.

Methods

toString() → String

Returns a string representation of this object.

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