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.
69 lines
1.7 KiB
69 lines
1.7 KiB
11 months ago
|
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;
|
||
|
|
||
|
|
||
|
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 ,
|
||
|
|
||
|
});
|
||
|
|
||
|
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"],
|
||
|
);
|
||
|
|
||
|
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,
|
||
|
};
|
||
|
}
|