selections property

  1. @visibleForTesting
List<TextSelection> selections

The ongoing selections in this paragraph.

The selection does not include selections in PlaceholderSpan if there are any.

Implementation

@visibleForTesting
List<TextSelection> get selections {
  if (_lastSelectableFragments == null) {
    return const <TextSelection>[];
  }
  final List<TextSelection> results = <TextSelection>[];
  for (final _SelectableFragment fragment in _lastSelectableFragments!) {
    if (fragment._textSelectionStart != null &&
        fragment._textSelectionEnd != null) {
      results.add(
        TextSelection(
          baseOffset: fragment._textSelectionStart!.offset,
          extentOffset: fragment._textSelectionEnd!.offset
        )
      );
    }
  }
  return results;
}