Campaign.fromJson constructor
Campaign.fromJson(
- Map<String, dynamic> json
)
Implementation
Campaign.fromJson(Map<String, dynamic> json) {
// Set the id campaign
idCampaign = (json['id'] ?? "") as String;
// Set the name of campaign
name = (json['name'] ?? "") as String;
// Set the variation groupId
variationGroupId = (json['variationGroupId'] ?? "") as String;
// Set the name of variation group name
variationGroupName = (json["variationGroupName"] ?? "") as String;
// Set variation object
if (json.keys.contains('variation')) {
variation = Variation.fromJson(json['variation'] as Map<String, dynamic>);
}
// Set Type of cmapaign
campaignType = (json['type'] ?? "") as String;
// Set slug
slug = json['slug'];
}