Surah class
Represents a complete surah (chapter) from the Quran.
A surah is one of the 114 chapters of the Quran. Each surah contains one or more ayat (verses) and has various attributes including its revelation location and order.
Example usage:
final surah = await QuranService.getSurah(1); // Al-Fatiha
print('${surah.englishName} has ${surah.numberOfAyahs} ayat');
print('Revealed in ${surah.revelationType}');
Constructors
-
Surah.new({required int id, required String name, required String englishName, required String revelationType, required int numberOfAyahs, required int revelationOrder, required List<
Ayah> ayat, String source = "Tanzil Project - https://tanzil.net"}) -
const
- Surah.basic({required int id, required String name, required String englishName, required String revelationType, required int numberOfAyahs, required int revelationOrder, String source = "Tanzil Project - https://tanzil.net"})
-
Creates a basic Surah without ayat (for references)
factory
-
Surah.fromJson(Map<
String, dynamic> json) -
Creates a Surah from JSON data
factory
Properties
-
ayat
→ List<
Ayah> -
List of all ayat in this surah
final
- englishName → String
-
The English name of the surah
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- hasSajdah → bool
-
Whether this surah contains any sajdah ayat
no setter
- id → int
-
The surah number in Mushaf order (1-114)
final
- isMeccan → bool
-
Whether this surah was revealed in Mecca
no setter
- isMedianan → bool
-
Whether this surah was revealed in Medina
no setter
- name → String
-
The Arabic name of the surah
final
- numberOfAyahs → int
-
The total number of ayat in this surah
final
- revelationOrder → int
-
The chronological revelation order (1-114)
final
- revelationType → String
-
The revelation type: "Meccan" or "Medinan"
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sajdahAyat
→ List<
Ayah> -
Get all sajdah ayat in this surah
no setter
- source → String
-
Source attribution for the Quran text
final
Methods
-
copyWith(
{int? id, String? name, String? englishName, String? revelationType, int? numberOfAyahs, int? revelationOrder, List< Ayah> ? ayat, String? source}) → Surah - Creates a copy of this Surah with the given fields replaced with new values
-
getAyah(
int ayahNumber) → Ayah? - Get a specific ayah by its number
-
getAyahRange(
int startAyah, int endAyah) → List< Ayah> - Get a range of ayat from this surah
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts the Surah to JSON
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override