setComposingRect method Null safety

void setComposingRect(
  1. Rect rect

Send the smallest rect that covers the text in the client that's currently being composed.

The given rect can not be null. If any of the 4 coordinates of the given Rect is not finite, a Rect of size (-1, -1) will be sent instead.

This information is used for positioning the IME candidates menu on each platform.


void setComposingRect(Rect rect) {
  assert(rect != null);
  if (rect == _cachedRect)
  _cachedRect = rect;
  final Rect validRect = rect.isFinite ? rect : & const Size(-1, -1);
    <String, dynamic>{
      'width': validRect.width,
      'height': validRect.height,
      'x': validRect.left,