toRRect method Null safety

RRect toRRect(
  1. Rect rect

Creates an RRect from the current border radius and a Rect.

If any of the radii have negative values in x or y, those values will be clamped to zero in order to produce a valid RRect.


RRect toRRect(Rect rect) {
  // Because the current radii could be negative, we must clamp them before
  // converting them to an RRect to be rendered, since negative radii on
  // RRects don't make sense.
  return RRect.fromRectAndCorners(
    topLeft: topLeft.clamp(minimum:, // ignore_clamp_double_lint
    topRight: topRight.clamp(minimum:, // ignore_clamp_double_lint
    bottomLeft: bottomLeft.clamp(minimum:, // ignore_clamp_double_lint
    bottomRight: bottomRight.clamp(minimum:, // ignore_clamp_double_lint