CampaignDTO.fromJson constructor
CampaignDTO.fromJson(
- Map<String, dynamic> json
)
Implementation
CampaignDTO.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
title = json['title'];
highlightRate = json['highlightRate'];
slug = json['slug'];
link = json['link'];
description = json['description'];
discountStartDate = json['discountStartDate'];
discountEndDate = json['discountEndDate'];
limit = json['limit'];
used = json['used'];
showOnMain = json['showOnMain'];
type = json['type'];
priceType = json['priceType'];
productCount = json['productCount'];
freeProductCount = json['freeProductCount'];
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));
});
}
if (json['brands'] != null) {
brands = <BrandDTO>[];
json['brands'].forEach((v) {
brands!.add(BrandDTO.fromJson(v));
});
}
if (json['tags'] != null) {
tags = <TagDTO>[];
json['tags'].forEach((v) {
tags!.add(TagDTO.fromJson(v));
});
}
photo = json['photo'] != null ? PhotoDTO.fromJson(json['photo']) : null;
}