HizbResult.fromJson constructor
Creates a HizbResult from JSON data
Implementation
factory HizbResult.fromJson(Map<String, dynamic> json) {
final ayatList = json['ayat'] as List<dynamic>;
return HizbResult(
hizb: json['hizb'] as int,
juz: json['juz'] as int,
totalAyat: json['totalAyat'] as int,
ayat: ayatList
.map((ayahJson) =>
AyahWithSurah.fromJson(ayahJson as Map<String, dynamic>))
.toList(),
source:
json['source'] as String? ?? "Tanzil Project - https://tanzil.net",
);
}