mirror of
https://github.com/acamarata/pray-calc-dart.git
synced 2026-06-30 19:04:25 +00:00
Refactor: use nrel_spa package instead of bundled SPA
Replace the 1280-line bundled SPA implementation with a dependency on the nrel_spa package. SpaResult and SpaAnglesResult are now re-exported from nrel_spa for backwards compatibility. All 24 tests pass unchanged.
This commit is contained in:
parent
9167d86c7b
commit
971022734e
7 changed files with 19 additions and 1322 deletions
|
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Replaced bundled SPA implementation with the `nrel_spa` package dependency
|
||||||
|
- Removed `SpaResult` and `SpaAnglesResult` from local types (now re-exported from `nrel_spa`)
|
||||||
|
|
||||||
## [1.0.0] - 2026-03-08
|
## [1.0.0] - 2026-03-08
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
[](https://github.com/acamarata/pray-calc-dart/actions/workflows/ci.yml)
|
[](https://github.com/acamarata/pray-calc-dart/actions/workflows/ci.yml)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
|
||||||
Islamic prayer times for Dart and Flutter. Pure Dart port of [pray-calc](https://github.com/acamarata/pray-calc), implementing the NREL Solar Position Algorithm, MCW seasonal model, and dynamic twilight angles. Zero dependencies.
|
Islamic prayer times for Dart and Flutter. Pure Dart port of [pray-calc](https://github.com/acamarata/pray-calc), implementing the MCW seasonal model and dynamic twilight angles. Uses [nrel_spa](https://github.com/acamarata/nrel-spa-dart) for the NREL Solar Position Algorithm.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ Result: approximately 18 degrees at the equator, approximately 12-14 degrees at
|
||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
Dart SDK 3.7.0+. Works in Flutter (iOS, Android, Web, Desktop), Dart CLI, and server-side Dart. Zero external dependencies.
|
Dart SDK 3.7.0+. Works in Flutter (iOS, Android, Web, Desktop), Dart CLI, and server-side Dart. Single dependency: [nrel_spa](https://pub.dev/packages/nrel_spa).
|
||||||
|
|
||||||
## Related
|
## Related
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,4 @@ export 'src/solar_ephemeris.dart';
|
||||||
export 'src/msc.dart';
|
export 'src/msc.dart';
|
||||||
export 'src/asr.dart';
|
export 'src/asr.dart';
|
||||||
export 'src/qiyam.dart';
|
export 'src/qiyam.dart';
|
||||||
export 'src/spa.dart' show getSpa;
|
export 'package:nrel_spa/nrel_spa.dart' show getSpa, SpaResult, SpaAnglesResult;
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,9 @@
|
||||||
/// angle algorithm. Times are in local time as determined by the UTC offset.
|
/// angle algorithm. Times are in local time as determined by the UTC offset.
|
||||||
library;
|
library;
|
||||||
|
|
||||||
|
import 'package:nrel_spa/nrel_spa.dart';
|
||||||
|
|
||||||
import 'types.dart';
|
import 'types.dart';
|
||||||
import 'spa.dart';
|
|
||||||
import 'solar_ephemeris.dart';
|
import 'solar_ephemeris.dart';
|
||||||
import 'angles.dart';
|
import 'angles.dart';
|
||||||
import 'asr.dart';
|
import 'asr.dart';
|
||||||
|
|
|
||||||
1279
lib/src/spa.dart
1279
lib/src/spa.dart
File diff suppressed because it is too large
Load diff
|
|
@ -103,40 +103,4 @@ class SolarEphemeris {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SPA result from the NREL Solar Position Algorithm.
|
// SpaResult and SpaAnglesResult are provided by the nrel_spa package.
|
||||||
class SpaResult {
|
|
||||||
/// Topocentric zenith angle in degrees.
|
|
||||||
final double zenith;
|
|
||||||
|
|
||||||
/// Topocentric azimuth angle, eastward from north, in degrees.
|
|
||||||
final double azimuth;
|
|
||||||
|
|
||||||
/// Local sunrise time as fractional hours (NaN if polar).
|
|
||||||
final double sunrise;
|
|
||||||
|
|
||||||
/// Local sun transit time (solar noon) as fractional hours.
|
|
||||||
final double solarNoon;
|
|
||||||
|
|
||||||
/// Local sunset time as fractional hours (NaN if polar).
|
|
||||||
final double sunset;
|
|
||||||
|
|
||||||
/// Custom zenith angle results (one per angle in the input list).
|
|
||||||
final List<SpaAnglesResult> angles;
|
|
||||||
|
|
||||||
const SpaResult({
|
|
||||||
required this.zenith,
|
|
||||||
required this.azimuth,
|
|
||||||
required this.sunrise,
|
|
||||||
required this.solarNoon,
|
|
||||||
required this.sunset,
|
|
||||||
this.angles = const [],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sunrise/sunset pair for a custom zenith angle.
|
|
||||||
class SpaAnglesResult {
|
|
||||||
final double sunrise;
|
|
||||||
final double sunset;
|
|
||||||
|
|
||||||
const SpaAnglesResult({required this.sunrise, required this.sunset});
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
name: pray_calc_dart
|
name: pray_calc_dart
|
||||||
description: >
|
description: >
|
||||||
Islamic prayer times for Dart and Flutter. Pure Dart port of the pray-calc
|
Islamic prayer times for Dart and Flutter. Pure Dart port of the pray-calc
|
||||||
library implementing the NREL Solar Position Algorithm, MCW seasonal model,
|
library implementing the MCW seasonal model and dynamic twilight angles.
|
||||||
and dynamic twilight angles. Zero dependencies.
|
Uses nrel_spa for the NREL Solar Position Algorithm.
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
repository: https://github.com/acamarata/pray-calc-dart
|
repository: https://github.com/acamarata/pray-calc-dart
|
||||||
issue_tracker: https://github.com/acamarata/pray-calc-dart/issues
|
issue_tracker: https://github.com/acamarata/pray-calc-dart/issues
|
||||||
|
|
@ -16,6 +16,10 @@ topics:
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.7.0
|
sdk: ^3.7.0
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
nrel_spa:
|
||||||
|
path: ../nrel-spa-dart
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
lints: ^5.0.0
|
lints: ^5.0.0
|
||||||
test: ^1.25.8
|
test: ^1.25.8
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue