Disclosure.fromJson constructor
Disclosure.fromJson(
- dynamic jsonObject
Implementation
Disclosure.fromJson(dynamic jsonObject) {
var decoded = credentialToMap(jsonObject);
if (decoded.containsKey('feature-type')) {
var fType = decoded['feature-type'];
if (fType == FeatureType.header.value) {
featureType = FeatureType.header;
} else if (fType == FeatureType.goalCode.value) {
featureType = FeatureType.goalCode;
} else if (fType == FeatureType.protocol.value) {
featureType = FeatureType.protocol;
} else if (fType == FeatureType.attachmentFormat.value) {
featureType = FeatureType.attachmentFormat;
} else {
throw Exception('unknown Feature-type');
}
} else {
throw Exception('Property Feature-Type is needed');
}
if (decoded.containsKey('id')) {
id = decoded['id'];
} else {
throw Exception('property id is needed in Disclosure-object');
}
if (decoded.containsKey('roles')) {
roles = decoded['roles'].cast<String>();
}
}