fromJson static method
Returns a new GenerateDmarcRecordOptions instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static GenerateDmarcRecordOptions? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "GenerateDmarcRecordOptions[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "GenerateDmarcRecordOptions[$key]" has a null value in JSON.');
});
return true;
}());
return GenerateDmarcRecordOptions(
domain: mapValueOfType<String>(json, r'domain')!,
version: GenerateDmarcRecordOptionsVersionEnum.fromJson(json[r'version'])!,
policy: GenerateDmarcRecordOptionsPolicyEnum.fromJson(json[r'policy'])!,
subdomainPolicy: GenerateDmarcRecordOptionsSubdomainPolicyEnum.fromJson(json[r'subdomainPolicy']),
reportEmailAddress: json[r'reportEmailAddress'] is List
? (json[r'reportEmailAddress'] as List).cast<String>()
: const [],
forensicEmailAddress: json[r'forensicEmailAddress'] is List
? (json[r'forensicEmailAddress'] as List).cast<String>()
: const [],
percentage: mapValueOfType<int>(json, r'percentage'),
reportFormat: GenerateDmarcRecordOptionsReportFormatEnum.fromJson(json[r'reportFormat']),
secondsBetweenReports: mapValueOfType<int>(json, r'secondsBetweenReports'),
adkim: GenerateDmarcRecordOptionsAdkimEnum.fromJson(json[r'adkim']),
aspf: GenerateDmarcRecordOptionsAspfEnum.fromJson(json[r'aspf']),
fo: GenerateDmarcRecordOptionsFoEnum.fromJson(json[r'fo']),
);
}
return null;
}