rotate method

Point rotate(
  1. double degrees, {
  2. Point center = Point.zero,
})

Implementation

Point rotate(double degrees, {Point center = Point.zero}) {
  final radians = degrees * math.pi / 180;
  final off = this - center;
  final cos = math.cos(radians);
  final sin = math.sin(radians);
  return Point(off.x * cos - off.y * sin, off.x * sin + off.y * cos) + center;
}