toJson method
Implementation
Map<String, dynamic> toJson() => {
"id": id,
"code": code,
"amount": amount,
"date_created": dateCreated!.toIso8601String(),
"date_created_gmt": dateCreatedGmt!.toIso8601String(),
"date_modified": dateModified!.toIso8601String(),
"date_modified_gmt": dateModifiedGmt!.toIso8601String(),
"discount_type": discountType,
"description": description,
"date_expires": dateExpires,
"date_expires_gmt": dateExpiresGmt,
"usage_count": usageCount,
"individual_use": individualUse,
"product_ids": List<dynamic>.from(productIds!.map((x) => x)),
"excluded_product_ids":
List<dynamic>.from(excludedProductIds!.map((x) => x)),
"usage_limit": usageLimit,
"usage_limit_per_user": usageLimitPerUser,
"limit_usage_to_x_items": limitUsageToXItems,
"free_shipping": freeShipping,
"product_categories":
List<dynamic>.from(productCategories!.map((x) => x)),
"excluded_product_categories":
List<dynamic>.from(excludedProductCategories!.map((x) => x)),
"exclude_sale_items": excludeSaleItems,
"minimum_amount": minimumAmount,
"maximum_amount": maximumAmount,
"email_restrictions":
List<dynamic>.from(emailRestrictions!.map((x) => x)),
"used_by": List<dynamic>.from(usedBy!.map((x) => x)),
"meta_data": List<dynamic>.from(metaData!.map((x) => x)),
"_links": links!.toJson(),
};