translate method Null safety

Rect translate(
  1. double translateX,
  2. double translateY
)

Returns a new rectangle with translateX added to the x components and translateY added to the y components.

To translate a rectangle by an Offset rather than by separate x and y components, consider shift.

Implementation

Rect translate(double translateX, double translateY) {
  return Rect.fromLTRB(left + translateX, top + translateY, right + translateX, bottom + translateY);
}