setSelection method

void setSelection(
  1. int start,
  2. int end
)

Select a range of text.

Notice that JidoujishoSelectableText.onSelectionChanged won't be called.

Implementation

void setSelection(int start, int end) {
  if (_textSpanEditingController == null) {
    return;
  }

  assert(start <= end);

  selection = TextSelection(
    baseOffset: start,
    extentOffset: end,
  );

  _textSpanEditingController!.value =
      _textSpanEditingController!.value.copyWith(selection: selection);
}