Campaigns.fromJson constructor

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

Implementation

Campaigns.fromJson(Map<String, dynamic> json) {
  // Set visitorId
  visitorId = (json['visitorId'] ?? "") as String;
  // Set panic
  if (json.keys.contains("panic")) {
    panic = json['panic'] as bool;
  }

  var list = (json['campaigns'] ?? []) as List<dynamic>;
  campaigns = list.map((e) {
    return Campaign.fromJson(e);
  }).toList();
}