RequestPresentation constructor

RequestPresentation({
  1. String? id,
  2. required List<PresentationDefinitionWithOptions> presentationDefinition,
  3. bool? willConfirm = false,
  4. String? goalCode,
  5. String? comment,
  6. String? replyUrl,
  7. List<String>? replyTo,
  8. String? parentThreadId,
  9. String? threadId,
  10. String? from,
  11. List<String>? to,
  12. DateTime? createdTime,
  13. DateTime? expiresTime,
  14. bool pleaseAck = false,
  15. FromPriorJWT? fromPrior,
  16. Map<String, dynamic>? additionalHeaders,
  17. WebRedirect? webRedirect,
  18. ReturnRouteValue? returnRoute,
  19. DidcommMessageTyp? typ,
})

Implementation

RequestPresentation(
    {String? id,
    required this.presentationDefinition,
    this.willConfirm = false,
    this.goalCode,
    this.comment,
    super.replyUrl,
    super.replyTo,
    super.parentThreadId,
    super.threadId,
    super.from,
    List<String>? super.to,
    super.createdTime,
    super.expiresTime,
    super.pleaseAck,
    super.fromPrior,
    super.additionalHeaders,
    super.webRedirect,
    super.returnRoute,
    super.typ})
    : super(
          id: id ?? Uuid().v4(),
          type: DidcommMessages.requestPresentation,
          body: {}) {
  if (goalCode != null) body['goal_code'] = goalCode;
  if (comment != null) body['comment'] = comment;
  body['will_confirm'] = willConfirm;
  attachments = [];
  for (var d in presentationDefinition) {
    var attachment = Attachment(
        data: AttachmentData(json: d.toJson()),
        id: Uuid().v4(),
        format: AttachmentFormat.presentationDefinition2,
        mediaType: 'application/json');
    attachments!.add(attachment);
  }
}