SurahStatistics.fromJson constructor

SurahStatistics.fromJson(
  1. Map<String, dynamic> json
)

Creates SurahStatistics from JSON data

Implementation

factory SurahStatistics.fromJson(Map<String, dynamic> json) {
  return SurahStatistics(
    totalSurahs: json['totalSurahs'] as int,
    totalAyat: json['totalAyat'] as int,
    meccanSurahs: json['meccanSurahs'] as int,
    medinanSurahs: json['medinanSurahs'] as int,
    averageAyatPerSurah: (json['averageAyatPerSurah'] as num).toDouble(),
    longestSurah:
        Surah.fromJson(json['longestSurah'] as Map<String, dynamic>),
    shortestSurah:
        Surah.fromJson(json['shortestSurah'] as Map<String, dynamic>),
    ayatCounts:
        AyatCounts.fromJson(json['ayatCounts'] as Map<String, dynamic>),
    revelationAnalysis: RevelationAnalysis.fromJson(
        json['revelationAnalysis'] as Map<String, dynamic>),
    source:
        json['source'] as String? ?? "Tanzil Project - https://tanzil.net",
  );
}