Selection class

Selection represents the selected area or the cursor area in the editor.

Selection is directional.

  1. forward,the end position is before the start position.
  2. backward, the end position is after the start position.
  3. collapsed, the end position is equal to the start position.

Constructors

Selection({required Position start, required Position end})
Create a selection with start, end.
Selection.collapse(Path path, int offset)
Create a collapsed selection with position.
Selection.collapsed(Position position)
Create a collapsed selection with position.
Selection.fromJson(Map<String, dynamic> json)
factory
Selection.invalid()
Selection.single({required Path path, required int startOffset, int? endOffset})
Create a selection with Path, startOffset and endOffset.

Properties

end Position
final
endIndex int
Returns the offset in the ending position under the normalized selection.
no setter
hashCode int
The hash code for this object.
no setteroverride
isBackward bool
Returns a Boolean indicating whether the selection is backward.
no setter
isCollapsed bool
Returns a Boolean indicating whether the selection's start and end points are at the same position.
no setter
isForward bool
Returns a Boolean indicating whether the selection is forward.
no setter
isSingle bool
Returns a Boolean indicating whether the selection's start and end points are at the same path.
no setter
length int
no setter
normalized Selection
Returns a normalized selection that direction is forward.
no setter
reversed Selection
Returns a reversed selection.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
start Position
final
startIndex int
Returns the offset in the starting position under the normalized selection.
no setter

Methods

collapse({bool atStart = false}) Selection
Collapses the current selection to a single point.
copyWith({Position? start, Position? end}) Selection
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override