translate method

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

Returns a new offset with translateX added to the x component and translateY added to the y component.

If the arguments come from another Offset, consider using the + or - operators instead:

Offset a = const Offset(10.0, 10.0);
Offset b = const Offset(10.0, 10.0);
Offset c = a + b; // same as: a.translate(b.dx, b.dy)
Offset d = a - b; // same as: a.translate(-b.dx, -b.dy)

Implementation

Offset translate(double translateX, double translateY) => Offset(dx + translateX, dy + translateY);