ProposeCredential constructor

ProposeCredential({
  1. String? id,
  2. String? goalCode,
  3. String? comment,
  4. PreviewCredential? credentialPreview,
  5. List<LdProofVcDetail>? detail,
  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

ProposeCredential(
    {String? id,
    this.goalCode,
    this.comment,
    this.credentialPreview,
    this.detail,
    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(
          type: DidcommMessages.proposeCredential,
          id: id ?? Uuid().v4(),
          body: {}) {
  if (comment != null) body['comment'] = comment;
  if (goalCode != null) body['goal_code'] = goalCode;
  if (credentialPreview != null) {
    body['credential_preview'] = credentialPreview!.toJson();
  }
  if (detail != null) {
    attachments = [];
    for (var a in detail!) {
      attachments!.add(Attachment(
          data: AttachmentData(json: a.toJson()),
          id: Uuid().v4(),
          format: AttachmentFormat.ldProofVcDetail,
          mediaType: 'application/json'));
    }
  }
}