54 lines
1.6 KiB
Dart
54 lines
1.6 KiB
Dart
class Product {
|
|
late int productId;
|
|
late String name;
|
|
late String description;
|
|
late String type;
|
|
late String appVersion;
|
|
late int sort;
|
|
late int productSet;
|
|
late DateTime validFrom;
|
|
late DateTime? validTo;
|
|
late String? productIdIos;
|
|
late String? productIdAndroid;
|
|
late double? priceIos;
|
|
late double? priceAndroid;
|
|
String? localizedPrice;
|
|
|
|
Product.fromJson(Map json) {
|
|
this.productId = json['productId'];
|
|
this.name = json['name'];
|
|
this.description = json['description'];
|
|
this.type = json['type'];
|
|
this.appVersion = json['appVersion'];
|
|
this.sort = json['sort'];
|
|
this.productSet = json['productSet'];
|
|
this.validFrom = (json['validFrom'] == null ? null : DateTime.parse(json['validFrom']))!;
|
|
this.validTo = json['validTo'] == null ? null : DateTime.parse(json['validTo']);
|
|
this.productIdIos = json['productIdIos'];
|
|
this.productIdAndroid = json['productIdAndroid'];
|
|
this.priceIos = json['priceIos'];
|
|
this.priceAndroid = json['priceAndroid'];
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
Map<String, dynamic> json = {
|
|
'productId': this.productId,
|
|
'name': this.name,
|
|
'description': this.description,
|
|
'type': this.type,
|
|
'appVersion': this.appVersion,
|
|
'sort': this.sort,
|
|
'productSet': this.productSet,
|
|
'validFrom': this.validFrom,
|
|
'validTo': validTo,
|
|
'productIdIos': this.productIdIos,
|
|
'productIdAndroid': this.productIdAndroid,
|
|
'priceIos': this.priceIos,
|
|
'priceAndroid': this.priceAndroid,
|
|
'localizedPrice': this.localizedPrice
|
|
};
|
|
return json.toString();
|
|
}
|
|
}
|