angleTo method

double angleTo(
  1. Offset other
)

Implementation

double angleTo(Offset other) {
  // Calculate the angle between this offset and the other offset
  double angle = math.atan2(other.dy - dy, other.dx - dx);

  // Convert radians to degrees
  double degrees = angle * 180 / math.pi;

  // Normalize the angle to be between 0 and 360 degrees
  if (degrees < 0) {
    degrees += 360;
  }

  return degrees;
}