CredentialStatus.fromJson constructor
CredentialStatus.fromJson(
- dynamic jsonObject
Implementation
factory CredentialStatus.fromJson(dynamic jsonObject) {
var status = credentialToMap(jsonObject);
String id;
if (status.containsKey('id')) {
id = status['id'];
} else {
throw FormatException('id property is needed in Credential Status');
}
String type;
if (status.containsKey('type')) {
type = status['type'];
} else {
throw FormatException('type property is needed in credentialStatus');
}
if (type == 'RevocationList2020Status') {
return RevocationList2020Status.fromJson(jsonObject);
} else if (type == 'StatusList2021Entry') {
return StatusList2021Entry.fromJson(jsonObject);
} else {
return CredentialStatus(id, type, status);
}
}