middleRect property Null safety

Rect middleRect

The rectangle that would be formed using the axis-aligned intersection of the sides of the rectangle, i.e., the rectangle formed from the inner-most centers of the ellipses that form the corners. This is the intersection of the wideMiddleRect and the tallMiddleRect. If any of the intersections are void, the resulting Rect will have negative width or height.

Implementation

Rect get middleRect {
  final double leftRadius = math.max(blRadiusX, tlRadiusX);
  final double topRadius = math.max(tlRadiusY, trRadiusY);
  final double rightRadius = math.max(trRadiusX, brRadiusX);
  final double bottomRadius = math.max(brRadiusY, blRadiusY);
  return Rect.fromLTRB(
    left + leftRadius,
    top + topRadius,
    right - rightRadius,
    bottom - bottomRadius
  );
}