iamriajul / adhan-dart

Adhan for Dart / Muslim Prayer Times Library. Now retrieving Prayer time in Dart easier than ever.
https://pub.dev/packages/adhan
MIT License
86 stars 41 forks source link

Exception with prayer times [Bug] #46

Open k0T0z opened 1 year ago

k0T0z commented 1 year ago

======== Exception caught by widgets library ======================================================= The following FormatException was thrown building HomeContentPrayerTimeItem(dirty): ishaAngle's value isn't define

Describe the bug when choosing "umm alqura uni, mekka" as a calculation method with "hanafi" as a madhab and "based on angle" as a high latitude rule the plugin returns an exception, this isn't supposed to happen.

To Reproduce Steps to reproduce the behavior:

  1. Try to read prayer times after setting calculation parameters as shown above.

Expected behavior The plugin must not return this exception

Screenshots image image

Environment(please complete the following information):

k0T0z commented 1 year ago

@iamriajul @KarimMohamed20 ?

JMApps commented 1 year ago
Снимок экрана 2023-01-31 в 07 50 28

@saifkandil Works fine for me when selecting Mecca with prayer time calculation Umm al-Qura. You may not be initializing everything in the correct sequence

k0T0z commented 1 year ago

@JMApps the problem is not with selecting "umm alqura uni, mekka" alone try to select it with other parameters I specified above, please

JMApps commented 1 year ago

@saifkandil Works fine for me and doesn't throw any exception, Hanafi method for asr prayer is selected in the screenshot and Umm al-Qura for prayer times. But I didn't understand "based on angle".

k0T0z commented 1 year ago

@JMApps Sorry I didn't clarify it at first it's twilight angle for high latitude rule (I use it as Based on angle so that user can understand it)

/// Rules for dealing with Fajr and Isha at places with high latitudes
enum HighLatitudeRule {
  /// Fajr will never be earlier than the middle of the night, and Isha will never be later than
  /// the middle of the night.
  middle_of_the_night,

  /// Fajr will never be earlier than the beginning of the last seventh of the night, and Isha will
  /// never be later than the end of hte first seventh of the night.
  seventh_of_the_night,

  /// Similar to [HighLatitudeRule.seventh_of_the_night], but instead of 1/7th, the faction
  /// of the night used is fajrAngle / 60 and ishaAngle/60.
  twilight_angle
}

In short, steps to reproduce is: set your High latitude rule -> twilight_angle Calculation method -> Umm Al-qura University, Makkah Madhab -> Hanafi

k0T0z commented 1 year ago

did you managed to reproduce it? @JMApps

JMApps commented 9 months ago

Yes bro @k0T0z , I apologize for the late response. I reproduced it, you need to initialize: twilight_angle at the very end:

_prayerTimes = PrayerTimes.today(
  _coordinates,
  _prayerParams,
  utcOffset: AppStyles.calculationUtcOffset[timeOffsetIndex],
);

_sunnahTimes = SunnahTimes(_prayerTimes);
_qibla = Qibla(_coordinates);
_prayerParams.highLatitudeRule = HighLatitudeRule.twilight_angle;