class responseModal{ String? error; List? list; FavoritesModel({this.error, this.list}); FavoritesModel.fromJson(Map json) { error = json['error']; if (json['list'] != null) { list = []; json['list'].forEach((v) { list!.add(new favlist.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); data['error'] = this.error; if (this.list != null) { data['list'] = this.list!.map((v) => v.toJson()).toList(); } return data; } } class favlist { String? unit; String? quantity; String? salePrice; String? id; String? name; String? image; String? productExists; favlist( {this.unit, this.quantity, this.salePrice, this.id, this.name, this.image, this.productExists}); favlist.fromJson(Map json) { unit = json['unit']; quantity = json['quantity']; salePrice = json['sale_price']; id = json['id']; name = json['name']; image = json['image']; productExists = json['product_exists']; } Map toJson() { final Map data = new Map(); data['unit'] = this.unit; data['quantity'] = this.quantity; data['sale_price'] = this.salePrice; data['id'] = this.id; data['name'] = this.name; data['image'] = this.image; data['product_exists'] = this.productExists; return data; } }