setCaretRect method Null safety

void setCaretRect(
  1. Rect rect
)

Sends the coordinates of caret rect. This is used on macOS for positioning the accent selection menu.

Implementation

void setCaretRect(Rect rect) {
  assert(rect != null);
  if (rect == _cachedCaretRect) {
    return;
  }
  _cachedCaretRect = rect;
  final Rect validRect = rect.isFinite ? rect : Offset.zero & const Size(-1, -1);
  TextInput._instance._setCaretRect(
    <String, dynamic>{
      'width': validRect.width,
      'height': validRect.height,
      'x': validRect.left,
      'y': validRect.top,
    },
  );
}