mirror of
https://github.com/acamarata/qibla-dart.git
synced 2026-07-01 11:24:27 +00:00
* chore: surface-area parity audit vs qibla-js, bump to v1.0.1 Full gap analysis: qibla-dart already matches @acamarata/qibla on all five public functions (qiblaAngle, compassDir, compassName, qiblaGreatCircle, distanceKm) and three constants (kaabaLat, kaabaLng, earthRadiusKm). No runtime gaps found; 48/48 tests pass unchanged. Patch bump documents the audit and closes T-E10-01 (Mega Phase 1). * docs: add CHANGELOG.md for v1.0.1 release * chore: polish pubspec, add wiki docs
50 lines
1 KiB
Markdown
50 lines
1 KiB
Markdown
# Quickstart
|
|
|
|
## Install
|
|
|
|
Add to `pubspec.yaml`:
|
|
|
|
```yaml
|
|
dependencies:
|
|
qibla: ^1.0.1
|
|
```
|
|
|
|
Run `dart pub get`.
|
|
|
|
## Qibla Bearing
|
|
|
|
```dart
|
|
import 'package:qibla/qibla.dart';
|
|
|
|
void main() {
|
|
// New York
|
|
final bearing = qiblaAngle(40.7128, -74.0060);
|
|
print('Bearing to Ka''bah: ${bearing.toStringAsFixed(2)}°');
|
|
print('Compass direction: ${compassDir(bearing)}');
|
|
print('Full direction: ${compassPoint(bearing)}');
|
|
|
|
// Distance to Ka'bah
|
|
final km = distanceKm(40.7128, -74.0060, kaabaLat, kaabaLng);
|
|
print('Distance: ${km.toStringAsFixed(0)} km');
|
|
}
|
|
```
|
|
|
|
## Compass Directions
|
|
|
|
`compassDir` returns an 8-point abbreviation (N, NE, E, SE, S, SW, W, NW).
|
|
`compassPoint` returns the full name (North, Northeast, East, etc.).
|
|
|
|
```dart
|
|
final bearing = qiblaAngle(lat, lng);
|
|
final short = compassDir(bearing); // "NE"
|
|
final full = compassPoint(bearing); // "Northeast"
|
|
```
|
|
|
|
## Ka'bah Coordinates
|
|
|
|
The Ka'bah coordinates are exported as constants:
|
|
|
|
```dart
|
|
print(kaabaLat); // 21.4225
|
|
print(kaabaLng); // 39.8262
|
|
```
|