getSelectedText method

String getSelectedText()

Returns the currently selected text.

Implementation

String getSelectedText() {
  if (_selectionStart == null || _selectionEnd == null) return '';
  final start = math.min(_selectionStart!, _selectionEnd!);
  final end = math.max(_selectionStart!, _selectionEnd!);
  if (start == end) return '';
  return _value.sublist(start, end).join();
}