fromJson static method
Returns a new UserInfoResponse instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static UserInfoResponse? 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'sub'), 'Required key "UserInfoResponse[sub]" is missing from JSON.');
assert(json[r'sub'] != null, 'Required key "UserInfoResponse[sub]" has a null value in JSON.');
return true;
}());
return UserInfoResponse(
sub: mapValueOfType<String>(json, r'sub')!,
email: mapValueOfType<String>(json, r'email'),
emailVerified: mapValueOfType<bool>(json, r'email_verified'),
name: mapValueOfType<String>(json, r'name'),
givenName: mapValueOfType<String>(json, r'given_name'),
familyName: mapValueOfType<String>(json, r'family_name'),
preferredUsername: mapValueOfType<String>(json, r'preferred_username'),
picture: mapValueOfType<String>(json, r'picture'),
updatedAt: mapValueOfType<int>(json, r'updated_at'),
);
}
return null;
}