quran library

A comprehensive, lightweight, and offline-first Quran data package for Dart and Flutter applications.

This library provides access to the complete Quran text with authentic Arabic text from the Tanzil Project, along with powerful search capabilities, Islamic reading divisions (Juz/Hizb), and comprehensive statistics.

Features:

  • Complete Quran text (114 surahs, 6,236 ayat)
  • Zero dependencies, offline-first
  • Juz and Hizb reading divisions
  • Full-text Arabic search
  • Comprehensive statistics and analytics
  • Flutter and Dart compatible

Example usage:

import 'package:quran_data_dart/quran.dart';

// Initialize the service first
await QuranService.initialize();

// Get specific ayah
final ayah = await QuranService.getAyah(2, 255); // Ayat al-Kursi
print(ayah.text);

// Get complete surah
final surah = await QuranService.getSurah(1); // Al-Fatiha
print('${surah.englishName}: ${surah.numberOfAyahs} ayat');

// Search for text
final results = await QuranService.searchText('الله');
print('Found ${results.totalResults} ayat containing "الله"');

// Get daily Juz reading
final juz = await QuranService.getJuz(1);
print('Juz 1: ${juz.totalAyat} ayat');

// Get random ayah for daily reflection
final randomAyah = await QuranService.getRandomAyah();
print('Daily reflection: ${randomAyah.surah.englishName} ${randomAyah.id}');

Classes

Ayah
Represents a single ayah (verse) from the Quran.
AyahRange
Represents a range of consecutive ayat from a specific surah.
AyahRangeInfo
Information about an ayah range.
AyahWithSurah
Represents an ayah with its associated surah information.
AyatCounts
Statistics about ayat counts and distribution.
DataLoadingStats
Statistics about data loading performance and content.
DataSummary
Summary statistics about the Quran data.
HizbResult
Represents the result of getting a complete Hizb.
JuzResult
Represents the result of getting a complete Juz (Para).
JuzStatistics
Statistics about a Juz.
QuranConstants
Constants used throughout the Quran package.
QuranData
Represents the complete Quran dataset.
QuranDataLoader
Handles loading and parsing of Quran data from assets.
QuranDefaults
Configuration defaults.
QuranErrorMessages
Error messages used throughout the package.
QuranFeatureFlags
Feature flags for optional functionality.
QuranMessages
Success messages and informational constants.
QuranMetadata
Metadata about the Quran dataset.
QuranNumbers
Quran-specific numerical constants.
QuranRegexPatterns
Regex patterns for validation.
QuranService
The main service class providing access to Quran data and functionality.
QuranValidators
Validation utilities for Quran data parameters.
RevelationAnalysis
Analysis of revelation characteristics (Meccan vs Medinan).
RevelationCharacteristics
Characteristics of surahs from a specific revelation period.
SajdahResult
Represents the result of getting all sajdah (prostration) ayat.
SajdahStatistics
Statistics about sajdah ayat distribution.
SearchResult
Represents the result of a text search in the Quran.
SearchStatistics
Statistics about search results.
Surah
Represents a complete surah (chapter) from the Quran.
SurahSearchResult
Represents the result of searching for surahs by name.
SurahSearchStatistics
Statistics about surah search results.
SurahStatistics
Comprehensive statistics about the Quran.

Extensions

ArabicStringExtensions on String
Extensions on String for Arabic text handling.
QuranDateTimeExtensions on DateTime
Extensions on DateTime for Islamic calendar and formatting.
QuranDoubleExtensions on double
Extensions on double for formatting and calculations.
QuranIntExtensions on int
Extensions on int for Quran-specific operations.
QuranListExtensions on List<T>
Extensions on List for common operations.
QuranMapExtensions on Map<K, V>
Extensions on Map for common operations.