fromJson static method
Returns a new TrackingPixelDto instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static TrackingPixelDto? 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 "TrackingPixelDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "TrackingPixelDto[$key]" has a null value in JSON.');
});
return true;
}());
return TrackingPixelDto(
id: mapValueOfType<String>(json, r'id')!,
seen: mapValueOfType<bool>(json, r'seen')!,
recipient: mapValueOfType<String>(json, r'recipient'),
html: mapValueOfType<String>(json, r'html')!,
url: mapValueOfType<String>(json, r'url')!,
inboxId: mapValueOfType<String>(json, r'inboxId'),
sentEmailId: mapValueOfType<String>(json, r'sentEmailId'),
seenAt: mapDateTime(json, r'seenAt', ''),
createdAt: mapDateTime(json, r'createdAt', '')!,
);
}
return null;
}