Coupon.fromOpencartJson constructor
Coupon.fromOpencartJson(
- Map<String, dynamic> json
)
Implementation
Coupon.fromOpencartJson(Map<String, dynamic> json) {
try {
amount = double.parse(json['discount'].toString());
code = json['code'];
id = json['coupon_id'];
discountType = json['type'] == 'P' ? 'percent' : 'fixed_cart';
description = json['name'];
minimumAmount = 0.0;
maximumAmount = 0.0;
dateExpires = DateTime.parse(json['date_end']);
message = '';
} catch (e) {
// ignore: avoid_print
print(e.toString());
}
}