getCaretScreenRect method

Rect? getCaretScreenRect(
  1. String fragmentId,
  2. int localOffset
)

Returns a Rect in global screen coordinates representing the caret line at fragmentId/localOffset. Used to position the IME candidate window on macOS (via TextInputConnection.setCaretRect). Returns null if the fragment is not in this paragraph.

Implementation

Rect? getCaretScreenRect(String fragmentId, int localOffset) {
  final globalOffset = _localToGlobal(fragmentId, localOffset);
  if (globalOffset == null) return null;
  return _screenRectForPainterOffset(globalOffset);
}