insertStr method

void insertStr(
  1. String str
)

Replaces the current selection by str

Implementation

void insertStr(String str) {
  final sel = selection;
  text = text.replaceRange(selection.start, selection.end, str);
  final len = str.length;

  selection = sel.copyWith(
    baseOffset: sel.start + len,
    extentOffset: sel.start + len,
  );
}