fix price cast

null-safety-migration
error500 2021-11-15 13:55:44 +06:00
parent 9d10e06104
commit 9e9e9053bc
1 changed files with 5 additions and 5 deletions

View File

@ -17,8 +17,8 @@ class GoodResponse {
String name = '';
String? ean;
int? articul;
int? price;
int? optPrice;
double? price;
double? optPrice;
double? basePrice;
int? divisible;
String? updatedAt;
@ -30,9 +30,9 @@ class GoodResponse {
goodResponseBean.name = map['name'] as String;
goodResponseBean.ean = map['ean'] as String;
goodResponseBean.articul = map['articul'] as int;
goodResponseBean.price = map['price'] as int;
goodResponseBean.optPrice = map['opt_price'] as int;
goodResponseBean.basePrice = cast<double>(map['base_price']);
goodResponseBean.price = (cast<num>(map['price']) ?? 0).toDouble() ;
goodResponseBean.optPrice = (cast<num>(map['opt_price']) ?? 0).toDouble();
goodResponseBean.basePrice = (cast<num>(map['base_price']) ?? 0).toDouble();
goodResponseBean.divisible = map['divisible'] as int;
goodResponseBean.updatedAt = map['updated_at'] as String;
return goodResponseBean;