product_entity.g.dart
3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import 'package:wow_english/generated/json/base/json_convert_content.dart';
import 'package:wow_english/models/product_entity.dart';
ProductEntity $ProductEntityFromJson(Map<String, dynamic> json) {
final ProductEntity productEntity = ProductEntity();
final int? id = jsonConvert.convert<int>(json['id']);
if (id != null) {
productEntity.id = id;
}
final String? name = jsonConvert.convert<String>(json['name']);
if (name != null) {
productEntity.name = name;
}
final String? title = jsonConvert.convert<String>(json['title']);
if (title != null) {
productEntity.title = title;
}
final double? price = jsonConvert.convert<double>(json['price']);
if (price != null) {
productEntity.price = price;
}
final String? picUrl = jsonConvert.convert<String>(json['picUrl']);
if (picUrl != null) {
productEntity.picUrl = picUrl;
}
final String? bannerPicUrl = jsonConvert.convert<String>(
json['bannerPicUrl']);
if (bannerPicUrl != null) {
productEntity.bannerPicUrl = bannerPicUrl;
}
final String? detailPicUrl = jsonConvert.convert<String>(
json['detailPicUrl']);
if (detailPicUrl != null) {
productEntity.detailPicUrl = detailPicUrl;
}
final int? saleType = jsonConvert.convert<int>(json['saleType']);
if (saleType != null) {
productEntity.saleType = saleType;
}
final int? status = jsonConvert.convert<int>(json['status']);
if (status != null) {
productEntity.status = status;
}
final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']);
if (sortOrder != null) {
productEntity.sortOrder = sortOrder;
}
final int? validityType = jsonConvert.convert<int>(json['validityType']);
if (validityType != null) {
productEntity.validityType = validityType;
}
return productEntity;
}
Map<String, dynamic> $ProductEntityToJson(ProductEntity entity) {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = entity.id;
data['name'] = entity.name;
data['title'] = entity.title;
data['price'] = entity.price;
data['picUrl'] = entity.picUrl;
data['bannerPicUrl'] = entity.bannerPicUrl;
data['detailPicUrl'] = entity.detailPicUrl;
data['saleType'] = entity.saleType;
data['status'] = entity.status;
data['sortOrder'] = entity.sortOrder;
data['validityType'] = entity.validityType;
return data;
}
extension ProductEntityExtension on ProductEntity {
ProductEntity copyWith({
int? id,
String? name,
String? title,
double? price,
String? picUrl,
String? bannerPicUrl,
String? detailPicUrl,
int? saleType,
int? status,
int? sortOrder,
int? validityType,
}) {
return ProductEntity()
..id = id ?? this.id
..name = name ?? this.name
..title = title ?? this.title
..price = price ?? this.price
..picUrl = picUrl ?? this.picUrl
..bannerPicUrl = bannerPicUrl ?? this.bannerPicUrl
..detailPicUrl = detailPicUrl ?? this.detailPicUrl
..saleType = saleType ?? this.saleType
..status = status ?? this.status
..sortOrder = sortOrder ?? this.sortOrder
..validityType = validityType ?? this.validityType;
}
}