Orientação gerada a partir de informações públicas. Apenas para referência.
O pacote adhan é uma biblioteca Dart projetada para calcular os horários de oração islâmica (Adhan) com base na localização geográfica e data. Ele fornece horários de oração precisos em tempo real usando métodos de cálculo configuráveis e suporta múltiplos fusos horários. Ideal para usuários muçulmanos ou desenvolvedores criando aplicativos religiosos, simplifica a integração de funcionalidades de horários de oração em plataformas móveis, web e desktop. A biblioteca é leve, bem documentada e ativamente mantida.
Casos de uso
Aplicativos de horários de oração islâmica
Integrações de calendário religioso
Sistemas de lembrete diário
Aplicativos móveis e web para muçulmanos
Agendamento com consciência de fuso horário
Principais recursos
Cálculos precisos de horários de oração
Múltiplos métodos de cálculo
tempo baseado em geolocalização
Suporta todas as principais plataformas
Integração fácil com o Flutter
Intervalos de oração configuráveis
Indicado para
Desenvolvedores de aplicativos islâmicos
Projetos Flutter que exigem utilitários de tempo
Aplicativos direcionados a usuários muçulmanos
Aplicações multiplataforma
Usuários que precisam de horários exatos de Adhan
Considerações
Requer entrada de geolocalização precisa
O método de cálculo afeta os resultados
Pode ser necessário ajustes manuais de fuso horário
Depende de fontes externas de dados para precisão
Limitado aos horários de oração, não ao calendário islâmico completo
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
Adhan Dart / Flutter
Adhan Dart is a well tested and well documented library for calculating Islamic prayer times. Adhan Dart is written to
be compatible with Dart and Dart Native / Flutter / Android / iOS / Web etc... devices of all api versions. It has a
small method overhead, and has no external dependencies.
All astronomical calculations are high precision equations directly from the
book “Astronomical Algorithms” by Jean Meeus. This book is recommended by the
Astronomical Applications Department of the U.S. Naval Observatory and the Earth System Research Laboratory of the
National Oceanic and Atmospheric Administration.
Implementations of Adhan in other languages can be found in the parent repo Adhan
.
Usage
A simple usage example:
import'package:adhan/adhan.dart';
main() {
print('My Prayer Times');
final myCoordinates = Coordinates(23.9088, 89.1220); // Replace with your own location lat, lng.final params = CalculationMethod.karachi.getParameters();
params.madhab = Madhab.hanafi;
final prayerTimes = PrayerTimes.today(myCoordinates, params);
print("---Today's Prayer Times in Your Local Timezone(${prayerTimes.fajr.timeZoneName})---");
print(DateFormat.jm().format(prayerTimes.fajr));
print(DateFormat.jm().format(prayerTimes.sunrise));
print(DateFormat.jm().format(prayerTimes.dhuhr));
print(DateFormat.jm().format(prayerTimes.asr));
print(DateFormat.jm().format(prayerTimes.maghrib));
print(DateFormat.jm().format(prayerTimes.isha));
print('---');
// Custom Timezone Usage. (Most of you won't need this).print('NewYork Prayer Times');
final newYork = Coordinates(35.7750, -78.6336);
final nyUtcOffset = Duration(hours: -4);
final nyDate = DateComponents(2015, 7, 12);
final nyParams = CalculationMethod.north_america.getParameters();
nyParams.madhab = Madhab.hanafi;
final nyPrayerTimes = PrayerTimes(newYork, nyDate, nyParams, utcOffset: nyUtcOffset);
print(nyPrayerTimes.fajr.timeZoneName);
print(DateFormat.jm().format(nyPrayerTimes.fajr));
print(DateFormat.jm().format(nyPrayerTimes.sunrise));
print(DateFormat.jm().format(nyPrayerTimes.dhuhr));
print(DateFormat.jm().format(nyPrayerTimes.asr));
print(DateFormat.jm().format(nyPrayerTimes.maghrib));
print(DateFormat.jm().format(nyPrayerTimes.isha));
}
See Flutter Example Folder for Flutter Usage Example with Dynamic Location From GPS.
also, you can run pub run adhan to test quickly based on Hanafi, Karachi parameters.
*alternatively, without installing in project, you can run pub global activate adhan and then run pub global run adhan to test quickly.
Initialization parameters
Coordinates
Create a Coordinates object with the latitude and longitude for the location you want prayer times for.
final coordinates = newCoordinates(35.78056, -78.6389);
/// Coordinates Validation Support [Optional],/// to Support validation, use [validate: true] param, default: falsefinal validateTrue = newCoordinates(91.78056, -78.6389, validate: true); // Invalid Coordinates, will throw ArgumentErrorfinal validateFalse = newCoordinates(91.78056, -78.6389, validate: false); // Invalid Coordinates, won't throw ArgumentError
Date
The date parameter passed in should be an instance of the DateComponents object. The year, month, and day values need to be populated. All other values will be ignored. The year, month and day values should be for the local date that you want prayer times for. These date values are expected to be for the Gregorian calendar. There's also a convenience method for converting a DateTime to DateComponents.
final date = DateComponents(2015, 11, 1);
// orfinal date = DateComponents.from(DateTime.now());
Calculation parameters
The rest of the needed information is contained within the CalculationParameters class. Instead of manually initializing this class, it is recommended to use one of the pre-populated instances in the CalculationMethod class. You can then further customize the calculation parameters if needed.
final params = CalculationMethod.muslim_world_league.getParameters();
params.madhab = Madhab.hanafi;
params.adjustments.fajr = 2;
Parameter
Description
method
CalculationMethod name
fajrAngle
Angle of the sun used to calculate Fajr
maghribAngle
The angle of the sun used to calculate Maghrib
ishaAngle
Angle of the sun used to calculate Isha
ishaInterval
Minutes after Maghrib (if set, the time for Isha will be Maghrib plus ishaInterval)
madhab
Value from the Madhab object, used to calculate Asr
highLatitudeRule
Value from the HighLatitudeRule object, used to set a minimum time for Fajr and a max time for Isha
adjustments
PrayerAdjustments object with custom prayer time adjustments in minutes for each prayer time
CalculationMethod
Value
Description
muslim_world_league
Muslim World League. Fajr angle: 18, Isha angle: 17
egyptian
Egyptian General Authority of Survey. Fajr angle: 19.5, Isha angle: 17.5
karachi
University of Islamic Sciences, Karachi. Fajr angle: 18, Isha angle: 18
umm_al_qura
Umm al-Qura University, Makkah. Fajr angle: 18, Isha interval: 90. Note: you should add a +30 minute custom adjustment for Isha during Ramadan.
dubai
Method used in UAE. Fajr and Isha angles of 18.2 degrees.
qatar
Modified version of Umm al-Qura used in Qatar. Fajr angle: 18, Isha interval: 90.
kuwait
Method used by the country of Kuwait. Fajr angle: 18, Isha angle: 17.5
Fajr angle: 0, Isha angle: 0. This is the default value for method when initializing a CalculationParameters object.
Madhab
Value
Description
shafi
Earlier Asr time
hanafi
Later Asr time
HighLatitudeRule
Value
Description
middle_of_the_night
Fajr 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_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 the first seventh of the night
twilight_angle
Similar to SEVENTH_OF_THE_NIGHT, but instead of 1/7, the fraction of the night used is fajrAngle/60 and ishaAngle/60
Prayer Times
Once the PrayerTimes object has been initialized it will contain values for all five prayer times and the time for sunrise. The prayer times will be DateTime object instances initialized with Local values (converted from UTC via .toLocal method). To display these times for a different timezone than local a UTC Offset should be used, for example Duration.
final kushtiaUtcOffset = Duration(hours: 6);
final newYorkUtcOffset = Duration(hours: -4);
// then pass your offset to PrayerTimes like this:final prayerTimes = PrayerTimes(coordinates, date, params, utcOffset: newYorkUtcOffset);
Methods
name
return
timeForPrayer
DateTime instance
currentPrayer
Prayer enum instance
currentPrayerByDateTime
Prayer enum instance
nextPrayer
Prayer enum instance
nextPrayerByDateTime
Prayer enum instance
Sunnah Times
final prayerTimes = PrayerTimes(coordinates, date, params, utcOffset: newYorkUtcOffset);
final sunnahTimes = SunnahTimes(prayerTimes);
// and then access/// The midpoint between Maghrib and Fajr
sunnahTimes.middleOfTheNight
/// The beginning of the last third of the period between Maghrib and Fajr,/// a recommended time to perform Qiyam
sunnahTimes.lastThirdOfTheNight
Qibla
final qibla = Qibla(coordinates);
/// Qibla direction degree (Compass/Clockwise)
qibla.direction
Features and bugs
Please file feature requests and bugs at the issue tracker.
Adhan Java is a well tested and well documented library for calculating Islamic prayer times. Adhan Java is written to be compatible with Java and Android devices of all api versions. It compiles against Java 7 to ensure compatibility with Android. It has a small method overhead, and has no external dependencies.
All astronomical calculations are high precision equations directly from the book “Astronomical Algorithms” by Jean Meeus. This book is recommended by the Astronomical Applications Department of the U.S. Naval Observatory and the Earth System Research Laboratory of the National Oceanic and Atmospheric Administration.
Implementations of Adhan in other languages can be found in the Adhan repo.