HadithCollection.fromJson constructor

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

Implementation

factory HadithCollection.fromJson(Map<String, dynamic> json) {
  var collectionData = (json['collection'] as List)
      .map((data) => CollectionData.fromJson(data))
      .toList();

  return HadithCollection(
    name: json['name'],
    hasBooks: json['hasBooks'],
    hasChapters: json['hasChapters'],
    collection: collectionData,
    totalHadith: json['totalHadith'],
    totalAvailableHadith: json['totalAvailableHadith'],
  );
}