pray_times 0.0.1

SDKflutter
Platformandroidioswindowslinuxmacosweb

Islamic project aimed at providing a Dart library for calculating Muslim prayers times.

Prayer Times

Islamic project aimed at providing a Dart library for calculating Muslim prayers times.

Usage

import 'package:pray_times/pray_times.dart';

main() {
  double latitude = 31.7775067;
  double longitude = 35.2368801;
  double timezone = 2;

  PrayerTimes prayers = new PrayerTimes();
  prayers.setTimeFormat(prayers.Time24);
  prayers.setCalcMethod(prayers.MWL);
  prayers.setAsrJuristic(prayers.Shafii);
  prayers.setAdjustHighLats(prayers.AngleBased);
  var offsets = [0, 0, 0, 0, 0, 0, 0];
  prayers.tune(offsets);

  final date = DateTime(2023, DateTime.january, 20);
  List<String> prayerTimes =
  prayers.getPrayerTimes(date, latitude, longitude, timezone);
  List<String> prayerNames = prayers.getTimeNames();

  for (int i = 0; i < prayerTimes.length; i++) {
    print("${prayerNames[i]} - ${prayerTimes[i]}");
  }
}

Configuration

Calculation Methods

NameFajr AngleIsha AngleMaghrib DurationDescription
MWL1817Muslim World League, usually used in Europe, Far East and parts of America. Default in most calculators.
ISNA1515Islamic Society of North America, used in Canada and USA.
Umm al-Qura18.590 minutesUmm al-Qura University in Makkah which used in Saudi Arabia.
Karachi1818University of Islamic Sciences, Karachi.
Egypt19.517.5Egyptian General Authority of Survey.
Tehran17.714Institute of Geophysics at University of Tehran.
Jafari1614Shia Ithna Ashari that used in some Shia communities worldwide.
Custom00Calculation method for customization .

Madhab

ValueFactorDescription
Shafi1Asr begins when the length of any object's shadow equals the length of the object itself plus the length of that object's shadow at noon.
Hanafi2Asr begins when the length of any object's shadow is twice the length of the object plus the length of that object's shadow at noon.

High Latitude

In locations at higher latitude, twilight may persist throughout the night during some months of the year. In these abnormal periods, the determination of Fajr and Isha is not possible using the usual formulas mentioned in the previous section. To overcome this problem, several solutions have been proposed, three of which are described below.

ValueDescription
MIDDLE_OF_THE_NIGHTFajr will never be earlier than the middle of the night and Isha will never be later than the middle of the night
SEVENTH_OF_THE_NIGHTFajr will never be earlier than the beginning of the last seventh of the night and Isha will never be later than the end of the first seventh of the night
TWILIGHT_ANGLESimilar to SEVENTH_OF_THE_NIGHT, but instead of 1/7, the fraction of the night used is fajrAngle/60 and ishaAngle/60

License

MIT

References