qibla library

Qibla direction, great-circle path, and haversine distance for Dart.

Pure math, zero external dependencies. Computes the initial bearing from any point on Earth to the Ka'bah using spherical trigonometry.

Constants

earthRadiusKm → const double
Mean radius of the Earth in kilometers (WGS-84 volumetric mean).
kaabaLat → const double
Latitude of the Ka'bah center, Masjid al-Haram, Mecca (degrees north).
kaabaLng → const double
Longitude of the Ka'bah center, Masjid al-Haram, Mecca (degrees east).

Functions

compassDir(double bearing) String
Eight-point compass abbreviation for a bearing.
compassName(double bearing) String
Full compass direction name for a bearing.
distanceKm(double lat1, double lng1, double lat2, double lng2) double
Haversine distance between two coordinate pairs.
qiblaAngle(double lat, double lng) double
Qibla bearing in degrees clockwise from true north.
qiblaGreatCircle(double lat, double lng, [int steps = 120]) List<List<double>>
Great-circle waypoints from (lat, lng) to the Ka'bah.