updateCaretRect method

void updateCaretRect(
  1. Rect rect
)

Updates the caret rectangle so the platform can position the IME candidate window (e.g. NSTextInputContext on macOS) near the cursor. rect must be in Flutter view logical pixel coordinates.

Implementation

void updateCaretRect(Rect rect) {
  _lastCaretRect = rect;
  if (_connection == null || !_connection!.attached) return;
  // On web, setCaretRect/setComposingRect are no-ops. Use the real render
  // box transform + font style to position the hidden <textarea> instead.
  if (kIsWeb) {
    _updateWebImePosition();
    return;
  }
  _connection!.setCaretRect(rect);
  _connection!.setComposingRect(rect);
}