setCursorPosition method

void setCursorPosition(
  1. int position
)

Sets a UTF-16 offset, clamped and rounded down to a grapheme boundary.

Implementation

void setCursorPosition(int position) {
  _cursorPosition =
      _boundaries.lastWhere((p) => p <= position.clamp(0, length));
}