getRadians static method
getRadians will calculate the radians of the Theta (angle) between the {(0,0),(0,1)} vector the {center, point} vector
This is calculated with u.v / ||u||*||v|| where u is the vector pointing from center to point and u can be considered as <point.dx - center.dx, point.dy - center.dy> v is just <0,1> thus the dot product of u and v is (point.dx - center.dx) * 1 + 0 * (point.dy - center.dy) which results in point.dx - center.dx the denominator is length(u) * length(v) while length(v) is 1, thus denominator is length(u)
Implementation
static double getRadians({required Offset center, required Offset point}) {
/// determine the sign, if point is in I or II's quadrant, negative
/// if it's in III or IV's quadrant, positive
int sign = (point.dy - center.dy) > 0 ? 1 : -1;
return sign * acos(
(point.dx - center.dx) /
sqrt(pow(point.dx - center.dx, 2) + pow(point.dy - center.dy, 2))
);
}