textBeforeSelection property

String textBeforeSelection

Gets the source code before the beginning of the selection.

If there is no selection, returns text.

Implementation

String get textBeforeSelection {
  if (selectionStart == null) return text;
  return text.substring(0, selectionStart);
}