shia_hijri_calendar 0.3.3 copy "shia_hijri_calendar: ^0.3.3" to clipboard
shia_hijri_calendar: ^0.3.3 copied to clipboard

Official Shia (Sistani office) Hijri date for Dart & Flutter. Reads the authoritative date from sistani.org, caches it, and counts locally between month boundaries.

example/shia_hijri_calendar_example.dart

import 'package:shia_hijri_calendar/shia_hijri_calendar.dart';

Future<void> main() async {
  final calendar = ShiaHijriCalendar();
  try {
    final today = await calendar.today();
    print('Arabic : ${today.formatArabic()}'); // ١ المحرم ١٤٤٨هـ
    print('English: ${today.formatEnglish()}'); // 1 Muharram 1448 AH
    print('ISO    : ${today.toIso()}'); // 1448-01-01

    final snapshot = calendar.lastSnapshot;
    if (snapshot != null) {
      print('Anchor : ${snapshot.gregorianDate} -> ${snapshot.hijri}');
    }

    // Bidirectional conversion (exact where verified, else tabular estimate).
    final g2h = calendar.gregorianToHijri(DateTime(2026, 6, 20));
    print(
      'G->H   : 2026-06-20 = ${g2h.hijri.formatEnglish()} '
      '(${g2h.isVerified ? "verified" : "estimate"})',
    );

    final h2g = calendar.hijriToGregorian(HijriDate(1448, 1, 10));
    print('H->G   : 10 Muharram 1448 = $h2g');

    // Religious occasions — makes it a full calendar.
    final onAshura = calendar.occasionsOn(HijriDate(1448, 1, 10));
    print('Event  : ${onAshura.map((o) => o.arabicName).join(', ')}');
    print('Rajab  : ${calendar.occasionsInMonth(7).length} occasions');
    print('Today is holiday? ${calendar.isHoliday(today)}');
  } finally {
    calendar.close();
  }
}
5
likes
160
points
190
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Official Shia (Sistani office) Hijri date for Dart & Flutter. Reads the authoritative date from sistani.org, caches it, and counts locally between month boundaries.

Repository (GitHub)
View/report issues

Topics

#hijri #calendar #islamic #shia #date

License

MIT (license)

Dependencies

html, http

More

Packages that depend on shia_hijri_calendar