getCurrentSurahByPage method

SurahFontsModel getCurrentSurahByPage(
  1. int pageNumber
)

Retrieves the current Surah data for a given page number.

This method returns the SurahFontsModel 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: SurahFontsModel: The SurahFontsModel representing the Surah of the first Ayah on the specified page.

Implementation

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