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