RequestPresentation.fromJson constructor
RequestPresentation.fromJson(
- dynamic jsonObject
Implementation
RequestPresentation.fromJson(super.jsonObject)
: super.fromJson() {
if (type != DidcommMessages.requestPresentation) {
throw Exception('Unsupported type or version');
}
goalCode = body['goal_code'];
comment = body['comment'];
if (body['will_confirm'] != null) {
willConfirm = body['will_confirm'];
}
if (attachments != null && attachments!.isNotEmpty) {
presentationDefinition = [];
for (var a in attachments!) {
if (a.format == AttachmentFormat.presentationDefinition ||
a.format == AttachmentFormat.presentationDefinition2) {
a.data.resolveData();
presentationDefinition
.add(PresentationDefinitionWithOptions.fromJson(a.data.json!));
} else if (a.format == AttachmentFormat.indyProofRequest) {
throw UnimplementedError('Indy proof request is not supported');
} else {
//throw Exception('Unknown type');
}
}
}
}