fromJson static method
Returns a new ClientRegistrationRequest instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static ClientRegistrationRequest? 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'client_name'), 'Required key "ClientRegistrationRequest[client_name]" is missing from JSON.');
assert(json[r'client_name'] != null, 'Required key "ClientRegistrationRequest[client_name]" has a null value in JSON.');
assert(json.containsKey(r'redirect_uris'), 'Required key "ClientRegistrationRequest[redirect_uris]" is missing from JSON.');
assert(json[r'redirect_uris'] != null, 'Required key "ClientRegistrationRequest[redirect_uris]" has a null value in JSON.');
return true;
}());
return ClientRegistrationRequest(
clientName: mapValueOfType<String>(json, r'client_name')!,
redirectUris: json[r'redirect_uris'] is Iterable
? (json[r'redirect_uris'] as Iterable).cast<String>().toList(growable: false)
: const [],
grantTypes: json[r'grant_types'] is Iterable
? (json[r'grant_types'] as Iterable).cast<String>().toList(growable: false)
: const [],
responseTypes: json[r'response_types'] is Iterable
? (json[r'response_types'] as Iterable).cast<String>().toList(growable: false)
: const [],
scope: mapValueOfType<String>(json, r'scope'),
tokenEndpointAuthMethod: ClientRegistrationRequestTokenEndpointAuthMethodEnum.fromJson(json[r'token_endpoint_auth_method']) ?? const ClientRegistrationRequestTokenEndpointAuthMethodEnum._('none'),
clientUri: mapValueOfType<String>(json, r'client_uri'),
logoUri: mapValueOfType<String>(json, r'logo_uri'),
policyUri: mapValueOfType<String>(json, r'policy_uri'),
tosUri: mapValueOfType<String>(json, r'tos_uri'),
);
}
return null;
}