CredentialsSupportedObject.fromJson constructor
CredentialsSupportedObject.fromJson(
- dynamic data
Implementation
CredentialsSupportedObject.fromJson(dynamic data) {
var jsonObject = credentialToMap(data);
if (jsonObject.containsKey('format')) {
format = jsonObject['format'];
} else {
throw Exception('format property is needed');
}
id = jsonObject['id'];
if (jsonObject.containsKey('types')) {
type = jsonObject['types'].cast<String>();
} else {
if (jsonObject.containsKey('type')) {
type = [jsonObject['type']];
} else {
throw Exception('type(s) property needed');
}
}
if (jsonObject.containsKey('context')) {
context = jsonObject['@context'].cast<String>();
}
if (jsonObject.containsKey('cryptographic_binding_methods_supported')) {
cryptographicBindingMethods =
jsonObject['cryptographic_binding_methods_supported'].cast<String>();
}
if (jsonObject.containsKey('cryptographic_suites_supported')) {
cryptographicSuitesSupported =
jsonObject['cryptographic_suites_supported'].cast<String>();
}
if (jsonObject.containsKey('order')) {
order = jsonObject['order'].cast<String>();
}
if (jsonObject.containsKey('display')) {
List tmp = jsonObject['display'];
display = [];
for (var d in tmp) {
display!.add(OidcDisplayObject.fromJson(d));
}
}
if (jsonObject.containsKey('credentialSubject')) {
credentialSubject = {};
Map<String, dynamic> tmp = jsonObject['credentialSubject'];
tmp.forEach((key, value) {
credentialSubject![key] = CredentialSubjectMetadata.fromJson(value);
});
}
}