rotate method

Offset rotate({
  1. Offset center = Offset.zero,
  2. double angle = 0,
})

Implementation

Offset rotate({Offset center = Offset.zero, double angle = 0}) {
  final double x = center.dx +
      (dx - center.dx) * cos(angle) -
      (dy - center.dy) * sin(angle);
  final double y = center.dy +
      (dx - center.dx) * sin(angle) +
      (dy - center.dy) * cos(angle);
  return Offset(x, y);
}