You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tangheem/lib/models/surah_model.dart

85 lines
2.3 KiB
Dart

class SurahModel {
int totalItemsCount;
int statusCode;
Null message;
List<SurahModelData> data;
SurahModel({this.totalItemsCount, this.statusCode, this.message, this.data});
SurahModel.fromJson(Map<String, dynamic> json) {
totalItemsCount = json['totalItemsCount'];
statusCode = json['statusCode'];
message = json['message'];
if (json['data'] != null) {
data = new List<SurahModelData>();
json['data'].forEach((v) {
data.add(new SurahModelData.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['totalItemsCount'] = this.totalItemsCount;
data['statusCode'] = this.statusCode;
data['message'] = this.message;
if (this.data != null) {
data['data'] = this.data.map((v) => v.toJson()).toList();
}
return data;
}
}
class SurahModelData {
int id;
int surahID;
String nameAR;
String nameEN;
int numberOfAyahs;
String englishNameTranslation;
int revelationID;
String revelationType;
int startPageNo;
int endPageNo;
SurahModelData(
{this.id,
this.surahID,
this.nameAR,
this.nameEN,
this.numberOfAyahs,
this.englishNameTranslation,
this.revelationID,
this.revelationType,
this.startPageNo,
this.endPageNo});
SurahModelData.fromJson(Map<String, dynamic> json) {
id = json['id'];
surahID = json['surahID'];
nameAR = json['nameAR'];
nameEN = json['nameEN'];
numberOfAyahs = json['numberOfAyahs'];
englishNameTranslation = json['englishNameTranslation'];
revelationID = json['revelation_ID'];
revelationType = json['revelationType'];
startPageNo = json['startPageNo'];
endPageNo = json['endPageNo'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['surahID'] = this.surahID;
data['nameAR'] = this.nameAR;
data['nameEN'] = this.nameEN;
data['numberOfAyahs'] = this.numberOfAyahs;
data['englishNameTranslation'] = this.englishNameTranslation;
data['revelation_ID'] = this.revelationID;
data['revelationType'] = this.revelationType;
data['startPageNo'] = this.startPageNo;
data['endPageNo'] = this.endPageNo;
return data;
}
}