You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.0 KiB
79 lines
2.0 KiB
import 'dart:convert';
|
|
|
|
List<GetOffersDetailsModel> listdadFromJson(String str) => List<GetOffersDetailsModel >.from(json.decode(str).map((x) => GetOffersDetailsModel .fromJson(x)));
|
|
|
|
String listdadToJson(List<GetOffersDetailsModel > data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
|
|
|
|
class GetOffersDetailsModel {
|
|
String ? description;
|
|
String ? starting_date;
|
|
String ? ending_date;
|
|
String ? offer_code;
|
|
List<Picture> picture;
|
|
String ? offer_name;
|
|
String ? category;
|
|
String ? pharmacyId;
|
|
String request_status='';
|
|
|
|
|
|
GetOffersDetailsModel ({
|
|
required this.description,
|
|
required this.starting_date,
|
|
required this.ending_date,
|
|
required this.offer_code,
|
|
required this.picture,
|
|
required this.offer_name ,
|
|
required this.category ,
|
|
required this.pharmacyId ,
|
|
required this.request_status ,
|
|
});
|
|
|
|
factory GetOffersDetailsModel .fromJson(Map<String, dynamic> json) => GetOffersDetailsModel (
|
|
description: json["description"],
|
|
starting_date: json["starting_date"],
|
|
ending_date: json["ending_date"],
|
|
offer_code: json["offer_code"],
|
|
category: json["category"],
|
|
|
|
picture: List<Picture>.from(json["picture"].map((x) => Picture.fromJson(x))),
|
|
offer_name : json["offer_name"],
|
|
pharmacyId : json["pharmacyId"],
|
|
request_status : json["request_status"],
|
|
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"description": description,
|
|
"starting_date": starting_date,
|
|
"ending_date": ending_date,
|
|
"offer_code": offer_code,
|
|
"picture": List<dynamic>.from(picture.map((x) => x.toJson())),
|
|
"offer_name": offer_name,
|
|
"category": category,
|
|
"pharmacyId": pharmacyId,
|
|
"request_status": request_status,
|
|
|
|
|
|
|
|
};
|
|
}
|
|
|
|
class Picture {
|
|
String id;
|
|
String url;
|
|
|
|
Picture({
|
|
required this.id,
|
|
required this.url,
|
|
});
|
|
|
|
factory Picture.fromJson(Map<String, dynamic> json) => Picture(
|
|
id: json["_id"],
|
|
url: json["url"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"_id": id,
|
|
"url": url,
|
|
};
|
|
} |