getJuz static method
Get all ayat from a specific Juz (Para).
juzNumber
The Juz number (1-30)
Returns JuzResult containing all ayat in the specified Juz.
Throws ArgumentError if juzNumber is invalid.
Example:
final juz = await QuranService.getJuz(1);
print('Juz 1 contains ${juz.totalAyat} ayat');
Implementation
static Future<JuzResult> getJuz(int juzNumber) async {
await initialize();
_ensureDataLoaded();
QuranValidators.validateJuzNumber(juzNumber);
final List<AyahWithSurah> juzAyat = [];
for (final surah in _quranData!.surahs) {
for (final ayah in surah.ayat) {
if (ayah.juz == juzNumber) {
juzAyat.add(AyahWithSurah(
id: ayah.id,
text: ayah.text,
sajdah: ayah.sajdah,
juz: ayah.juz,
hizb: ayah.hizb,
surah: surah,
));
}
}
}
return JuzResult(
juz: juzNumber,
totalAyat: juzAyat.length,
ayat: juzAyat,
);
}