adhan_flutter 0.0.4
adhan_flutter: ^0.0.4

Flutter Android iOS

Adhan for Flutter / Muslim Prayer Times Plugin.

*** Use adhan for best compatibility and performances *** #

*** DEPRECATED *** #

adhan_flutter #

This plugin is an Intergration for adhan-java Library in Flutter using Platform Intergration/Platform Channels.

Installation #

In the dependencies: section of your pubspec.yaml, add the following line:

  adhan_flutter: <latest_version>

Usage #

// intl package for formatting date & time
import 'package:intl/intl.dart';
import 'package:adhan_flutter/adhan_flutter.dart';

class MyWidget extends StatelessWidget {
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        // getTodayFajrTime()
        Padding(
          padding: const EdgeInsets.all(8.0),
          child: FutureBuilder(
            future: getTodayFajrTime(),
            builder: (context, AsyncSnapshot<DateTime> snapshot) {
              if (snapshot.hasData) {
                final dateTime = snapshot.data.toLocal();
                return Text(DateFormat.jm().format(dateTime), style: TextStyle(
                  fontSize: 26,
                  fontWeight: FontWeight.bold
                ),);
              } else if (snapshot.hasError) {
                return Text(snapshot.error.toString());
              } else {
                return Text('Waiting...');
              }
            },
          ),
        ),
        
        // getCurrentPrayer()
        Padding(
          padding: const EdgeInsets.all(8.0),
          child: FutureBuilder(
            future: getCurrentPrayer(),
            builder: (context, AsyncSnapshot<Prayer> snapshot) {
              if (snapshot.hasData) {
                final prayer = snapshot.data;
                return Text(prayer.toString(), style: TextStyle(
                    fontSize: 26,
                    fontWeight: FontWeight.bold
                ),);
              } else if (snapshot.hasError) {
                return Text(snapshot.error.toString());
              } else {
                return Text('Waiting...');
              }
            },
          ),
        ),
      ]
    );
  }
  
  Future<DateTime> getTodayFajrTime() async {
    final adhan = AdhanFlutter.create(Coordinates(latitude, longitude), DateTime.now(), CalculationMethod.KARACHI);
    return await adhan.fajr;
  }

  Future<Prayer> getCurrentPrayer() async {
    final adhan = AdhanFlutter.create(Coordinates(latitude, longitude), DateTime.now(), CalculationMethod.KARACHI);
    return await adhan.currentPrayer();
  }
}

CalculationMethod

ValueDescription
MUSLIM_WORLD_LEAGUEMuslim World League. Fajr angle: 18, Isha angle: 17
EGYPTIANEgyptian General Authority of Survey. Fajr angle: 19.5, Isha angle: 17.5
KARACHIUniversity of Islamic Sciences, Karachi. Fajr angle: 18, Isha angle: 18
UMM_AL_QURAUmm al-Qura University, Makkah. Fajr angle: 18, Isha interval: 90. Note: you should add a +30 minute custom adjustment for Isha during Ramadan.
DUBAIMethod used in UAE. Fajr and Isha angles of 18.2 degrees.
QATARModified version of Umm al-Qura used in Qatar. Fajr angle: 18, Isha interval: 90.
KUWAITMethod used by the country of Kuwait. Fajr angle: 18, Isha angle: 17.5
MOON_SIGHTING_COMMITTEEMoonsighting Committee. Fajr angle: 18, Isha angle: 18. Also uses seasonal adjustment values.
SINGAPOREMethod used by Singapore. Fajr angle: 20, Isha angle: 18.
NORTH_AMERICAReferred to as the ISNA method. This method is included for completeness but is not recommended. Fajr angle: 15, Isha angle: 15
KUWAITKuwait. Fajr angle: 18, Isha angle: 17.5
OTHERFajr angle: 0, Isha angle: 0. This is the default value for method when initializing a CalculationParameters object.

Madhab

ValueDescription
SHAFIEarlier Asr time
HANAFILater Asr time

HighLatitudeRule

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

Example #

View the Flutter app in the example directory to see all the available Examples.

Projects Used #

TODO #

8
likes
70
pub points
60%
popularity

Publisher

riajul.dev

Adhan for Flutter / Muslim Prayer Times Plugin.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on adhan_flutter