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();
}