fromJson static method
Returns a new UserUpdatedEvent instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static UserUpdatedEvent? 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(() {
assert(json.containsKey(r'created_at'),
'Required key "UserUpdatedEvent[created_at]" is missing from JSON.');
assert(json[r'created_at'] != null,
'Required key "UserUpdatedEvent[created_at]" has a null value in JSON.');
assert(json.containsKey(r'custom'),
'Required key "UserUpdatedEvent[custom]" is missing from JSON.');
assert(json[r'custom'] != null,
'Required key "UserUpdatedEvent[custom]" has a null value in JSON.');
assert(json.containsKey(r'type'),
'Required key "UserUpdatedEvent[type]" is missing from JSON.');
assert(json[r'type'] != null,
'Required key "UserUpdatedEvent[type]" has a null value in JSON.');
assert(json.containsKey(r'user'),
'Required key "UserUpdatedEvent[user]" is missing from JSON.');
assert(json[r'user'] != null,
'Required key "UserUpdatedEvent[user]" has a null value in JSON.');
return true;
}());
return UserUpdatedEvent(
createdAt: mapDateTime(json, r'created_at', r'')!,
custom: mapCastOfType<String, Object>(json, r'custom')!,
receivedAt: mapDateTime(json, r'received_at', r''),
type: mapValueOfType<String>(json, r'type')!,
user: UserResponsePrivacyFields.fromJson(json[r'user'])!,
);
}
return null;
}