setText method

void setText(
  1. String text, {
  2. bool movePositionToEnd = true,
})

Implementation

void setText(String text, {bool movePositionToEnd = true}) {
  final curPos = (selection.end).clamp(0, this.text.length);
  final pos = movePositionToEnd ? (curPos + text.length) : curPos;
  this.text = text;
  setCursorPosition(position: pos);
}