searchSurah function

Future<List<SurahHeaderModel>> searchSurah(
  1. String text
)

Returns Al Quran data containing list of surah and its detail

Example:

searchSurah('Al Fatihah');

Returns List of Surahs:

{
surah:
      [
        {
        "id": 1,
        "name_arabic": "الفاتحة",
        "name_latin": "Al Fatihah",
        "asma": "الفاتحة",
        "ayah": 7,
        "type": "Makkiyah",
        "transliteration": "Al Fatihah",
        "audio": "https://server8.mp3quran.net/afs/001.mp3"
        },...
      ]
}

Length of the list is the total number of surah in Al Quran.

Implementation

Future<List<SurahHeaderModel>> searchSurah(String text) async {
  var surahList = await QuranDatasource.instance.getSurahList();
  var searchList = surahList
      .where((element) =>
          filterText(element.nameLatin!).contains(filterText(text)))
      .toList();
  return searchList;
}