clearTextAtCursor method

void clearTextAtCursor()

Clears the text at the current cursor position.

Implementation

void clearTextAtCursor() {
  final boundaries = _findChipTextBoundaries(selection.baseOffset);
  String text = value.text;
  StringBuffer buffer = StringBuffer();
  buffer.write(text.substring(0, boundaries.start));
  buffer.write(text.substring(boundaries.end));
  super.value = value.copyWith(
    text: buffer.toString(),
    selection: TextSelection.collapsed(offset: boundaries.start),
  );
}