fromJson static method
Returns a new InboxReplierEventProjection instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static InboxReplierEventProjection? 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 "InboxReplierEventProjection[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "InboxReplierEventProjection[$key]" has a null value in JSON.');
});
return true;
}());
return InboxReplierEventProjection(
message: mapValueOfType<String>(json, r'message'),
id: mapValueOfType<String>(json, r'id'),
status: InboxReplierEventProjectionStatusEnum.fromJson(json[r'status']),
recipients: json[r'recipients'] is List
? (json[r'recipients'] as List).cast<String>()
: const [],
userId: mapValueOfType<String>(json, r'userId'),
emailId: mapValueOfType<String>(json, r'emailId'),
inboxId: mapValueOfType<String>(json, r'inboxId'),
createdAt: mapDateTime(json, r'createdAt', '')!,
sentId: mapValueOfType<String>(json, r'sentId'),
replierId: mapValueOfType<String>(json, r'replierId'),
);
}
return null;
}