Campaign.fromJson constructor

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

Implementation

Campaign.fromJson(Map<String, dynamic> json) {
  // Set the id campaign
  idCampaign = (json['id'] ?? "") as String;
  // Set the variation groupId
  variationGroupId = (json['variationGroupId'] ?? "") 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'];
}