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.
 
 

41 lines
1.2 KiB

class Desire {
String productName;
String productID;
String productImage;
String enlisted;
double price;
String category;
Desire(
{this.productName,
this.enlisted,
this.productID,
this.productImage,
this.price,
this.category});
factory Desire.fromJSON(Map<String, dynamic> json) {
return Desire(
productID: json["productID"],
productName: json["productName"],
productImage: json["productImage"],
enlisted: json["enlisted"],
category: json["category"],
price: double.tryParse(json["cost"].toString()));
}
Map<dynamic, dynamic> toJson() {
final Map<dynamic, dynamic> data = Map<dynamic, dynamic>();
data['productID'] = this.productID;
data['productName'] = this.productName;
data['enlisted'] = this.enlisted;
data['productImage'] = this.productImage;
data['cost'] = this.price;
data['category'] = this.category;
return data;
}
@override
String toString() {
return '{"productID": "$productID", "productName": "$productName", "enlisted": "$enlisted","productImage":"$productImage","cost":"$price","category":"$category"}';
}
}