selections property
TextSelectionSet
get
selections
Active normalized selections. A single legacy cursor is returned when multi-cursor mode is inactive.
Implementation
TextSelectionSet get selections {
final active = _selections;
if (active != null) return active;
final snapshot = _currentOffsetStateSnapshot();
final baseOffset = snapshot.selectionBaseOffset;
final extentOffset = snapshot.selectionExtentOffset;
if (baseOffset == null || extentOffset == null) {
return TextSelectionSet.collapsed(cursorOffset);
}
return TextSelectionSet([
TextSelectionRange.directional(
anchorOffset: baseOffset,
activeOffset: extentOffset,
),
], primaryOffset: cursorOffset);
}