Bucketing.fromJson constructor

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

Implementation

Bucketing.fromJson(Map<String, dynamic> json) {
  // Set panic
  if (json.keys.contains("panic")) {
    panic = json['panic'] as bool;
  }
  // Construct bucketing object
  var list = (json['campaigns'] ?? []) as List<dynamic>;
  campaigns = list.map((e) {
    return BucketCampaign.fromJson(e);
  }).toList();

  // Construct Account settings
  if (json.keys.contains("accountSettings")) {
    accountSettings = AccountSettings.fromJson(json['accountSettings'] ?? {});
  }
}