1234567891011121314151617181920212223242526272829303132333435363738394041 |
- class ShoppingCartModel {
- String goodsName;
- String goodsId;
- String goodsImg;
- double orgPrice;
- double price;
- int count;
- bool isChecked;
- ShoppingCartModel({this.goodsName, this.goodsId, this.goodsImg, this.orgPrice, this.price, this.count, this.isChecked});
- ShoppingCartModel.fromJson(Map<String, dynamic> json) {
- goodsName = json['goodsName'];
- goodsId = json['goodsId'];
- goodsImg = json['goodsImg'];
- orgPrice = json['orgPrice'] + 0.0;
- price = json['price'] + 0.0;
- count = json['count'];
- isChecked = json['isChecked'];
- }
- static List<ShoppingCartModel> fromJsonList(dynamic maps) {
- List<ShoppingCartModel> list = List(maps.length);
- for (int i = 0; i < maps.length; i++) {
- list[i] = ShoppingCartModel.fromJson(maps[i]);
- }
- return list;
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = Map<String, dynamic>();
- data['goodsName'] = this.goodsName;
- data['goodsId'] = this.goodsId;
- data['goodsImg'] = this.goodsImg;
- data['orgPrice'] = this.orgPrice;
- data['price'] = this.price;
- data['count'] = this.count;
- data['isChecked'] = this.isChecked;
- return data;
- }
- }
|