prayertimes library
Prayer times for a date and location, across 21 published calculation methods.
final times = PrayerTimes.today(
latitude: -6.2851291,
longitude: 106.9814968,
utcOffset: const Duration(hours: 7),
parameters: const CalculationParameters.of(CalculationMethod.kemenag),
);
print(times.fajr.toLocal());
print(times.next());
Every time is a UTC instant carrying whole minutes, rounded up to match the C library's convention. Call DateTime.toLocal to render in the device's zone — but note that the device's zone and the location asked about are unrelated, which is why PrayerTimes never reads the device offset.
The FFI bindings this is built on are deliberately not exported. They live
under lib/src/ and are an implementation detail: their names, their
structs and their failure modes come from C and change when the vendored
header changes.
Classes
- CalculationParameters
- The parameter set a calculation runs with.
- PrayerTimes
- The prayer times for one civil day at one location.
Enums
- AsrSchool
- CalculationMethod
- A published prayer-time calculation method.
- HighLatitudeRule
- Which shadow length marks the start of Asr. What to do when the Sun never reaches a method's depression angle.
- Prayer
-
One of the five prescribed prayers
PrayerTimesreports.
Exceptions / Errors
- Thrown when the C library cannot produce a finite time for one or more prayers on the requested date and location.