CouponModel.fromJson constructor
CouponModel.fromJson(
- Map<String, dynamic> json
)
Implementation
factory CouponModel.fromJson(Map<String, dynamic> json) {
return CouponModel(
id: json['id'],
code: json['code'],
amount: json['amount'],
dateCreated: DateTime.parse(json['date_created']),
dateCreatedGmt: DateTime.parse(json['date_created_gmt']),
dateModified: DateTime.parse(json['date_modified']),
dateModifiedGmt: DateTime.parse(json['date_modified_gmt']),
discountType: json['discount_type'],
description: json['description'],
dateExpires: json['date_expires'],
dateExpiresGmt: json['date_expires_gmt'],
usageCount: json['usage_count'],
individualUse: json['individual_use'],
productIds: List<int>.from(json['product_ids']),
excludedProductIds: List<int>.from(json['excluded_product_ids']),
usageLimit: json['usage_limit'],
usageLimitPerUser: json['usage_limit_per_user'],
limitUsageToXItems: json['limit_usage_to_x_items'],
freeShipping: json['free_shipping'],
productCategories: List<int>.from(json['product_categories']),
excludedProductCategories:
List<int>.from(json['excluded_product_categories']),
excludeSaleItems: json['exclude_sale_items'],
minimumAmount: json['minimum_amount'],
maximumAmount: json['maximum_amount'],
emailRestrictions: List<String>.from(json['email_restrictions']),
usedBy: List<String>.from(json['used_by']),
metaData: List<Map<String, dynamic>>.from(
json['meta_data'].map((x) => Map<String, dynamic>.from(x))),
);
}