PromoCodeDTO.fromJson constructor

PromoCodeDTO.fromJson(
  1. Map<String, dynamic> json
)

Implementation

PromoCodeDTO.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
  code = json['code'];
  limit = json['limit'];
  used = json['used'];
  amount = json['amount'];
  amountType = json['amountType'];
  type = json['type'];
  if (json['products'] != null) {
    products = <ProductDTO>[];
    json['products'].forEach((v) {
      products!.add(ProductDTO.fromJson(v));
    });
  }
  if (json['categories'] != null) {
    categories = <CategoryDTO>[];
    json['categories'].forEach((v) {
      categories!.add(CategoryDTO.fromJson(v));
    });
  }
}