setText method

void setText(
  1. String newText
)

Sets the buffer to new text, cursor at end.

Implementation

void setText(String newText) {
  var text = newText;
  if (maxLength != null && text.length > maxLength!) {
    text = text.substring(0, maxLength!);
  }

  _buffer.clear();
  _buffer.write(text);
  _cursorPosition = text.length;
}