getSurah static method

Future<Surah> getSurah(
  1. int surahId
)

Get a complete surah with all its ayat.

surahId The surah number (1-114)

Returns Surah containing all ayat of the specified surah.

Throws ArgumentError if surahId is invalid.

Example:

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

Implementation

static Future<Surah> getSurah(int surahId) async {
  await initialize();
  _ensureDataLoaded();

  QuranValidators.validateSurahId(surahId);

  return _quranData!.surahs.firstWhere(
    (s) => s.id == surahId,
    orElse: () => throw ArgumentError('Surah $surahId not found'),
  );
}