import 'package:satu/core/utils/utils_parse.dart'; /// id : 6 /// category_id : 4 /// name : "KENT SILVER" /// ean : "46187413" /// articul : 1 /// price : 500 /// opt_price : 500 /// base_price : 500 /// divisible : 0 /// updated_at : "2021-02-03 11:37:34" class GoodResponse { int? id; int? categoryId; String name = ''; String? ean; int? articul; double? price; double? optPrice; double? basePrice; int? divisible; String? updatedAt; String? categoryName; static GoodResponse fromMap(dynamic map) { final GoodResponse goodResponseBean = GoodResponse(); goodResponseBean.id = map['id'] as int; goodResponseBean.categoryId = map['eacc_good_category_id'] as int?; goodResponseBean.name = map['name'] as String; goodResponseBean.ean = map['ean'] as String?; goodResponseBean.articul = map['articul'] as int; goodResponseBean.price = (cast(map['price']) ?? 0).toDouble() ; goodResponseBean.optPrice = (cast(map['opt_price']) ?? 0).toDouble(); goodResponseBean.basePrice = (cast(map['base_price']) ?? 0).toDouble(); goodResponseBean.divisible = map['divisible'] as int?; goodResponseBean.updatedAt = map['updated_at'] as String; goodResponseBean.categoryName = map['category_name'] as String?; return goodResponseBean; } Map toJson() { final Map map = { 'id': id, 'category_id': categoryId, 'name': name, 'ean': ean, 'articul': articul, 'price': price, 'opt_price': optPrice, 'base_price': basePrice, 'divisible': divisible, 'updated_at': updatedAt, }; return map; } }