getCurrentSurahByPage method

SurahModel getCurrentSurahByPage(
  1. int pageNumber
)

Retrieves the current Surah data for a given page number.

This method returns the SurahModel of the first Ayah on the specified page. It uses the Ayah data on the page to determine which Surah the page belongs to.

Parameters: pageNumber (int): The number of the page for which to retrieve the Surah.

Returns: SurahModel: The SurahModel representing the Surah of the first Ayah on the specified page.

Implementation

SurahModel getCurrentSurahByPage(int pageNumber) => state.surahs.firstWhere(
    (s) => s.ayahs.contains(getPageAyahsByIndex(pageNumber).first));