VariationGroup.fromJson constructor
VariationGroup.fromJson(
- Map<String, dynamic> json
)
Implementation
VariationGroup.fromJson(Map<String, dynamic> json) {
// Set idVariationGroup
if (json.keys.contains("id")) {
idVariationGroup = json['id'] as String;
}
// Create targeting
if (json.keys.contains("targeting")) {
targeting = Targeting.fromJson(json["targeting"]);
}
// Create variation
var list = (json['variations'] ?? []) as List<dynamic>;
variations = list.map((e) {
return Variation.fromJson(e);
}).toList();
}