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.
pharmacy/lib/models/approvedoffer_model.dart

69 lines
1.8 KiB

import 'dart:convert';
List<GetApprovedOffersDetailsModel> listdadFromJson(String str) => List<GetApprovedOffersDetailsModel >.from(json.decode(str).map((x) => GetApprovedOffersDetailsModel .fromJson(x)));
String listdadToJson(List<GetApprovedOffersDetailsModel > data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class GetApprovedOffersDetailsModel {
String ? description;
String ? starting_date;
String ? ending_date;
String ? offer_code;
List<Picture> picture;
String ? offer_name;
String ? category;
GetApprovedOffersDetailsModel ({
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 ,
});
factory GetApprovedOffersDetailsModel .fromJson(Map<String, dynamic> json) => GetApprovedOffersDetailsModel (
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"],
);
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,
};
}
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,
};
}