60 lines
1.7 KiB
Dart
60 lines
1.7 KiB
Dart
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<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;
|
|
goodResponseBean.categoryName = map['category_name'] as String?;
|
|
return goodResponseBean;
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> map = <String, dynamic>{
|
|
'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;
|
|
}
|
|
}
|