toJson method

  1. @override
Map<String, dynamic> toJson()
override

Implementation

@override
Map<String, dynamic> toJson() {
  if (_originalDoc != null) return Map.from(_originalDoc!);
  Map<String, dynamic> jsonObject = {};
  jsonObject['@context'] = context;
  jsonObject['type'] = type;
  if (verifiableCredential != null) {
    List tmp = [];
    for (var c in verifiableCredential!) {
      tmp.add(c.toJson());
    }
    jsonObject['verifiableCredential'] = tmp;
  }
  if (id != null) jsonObject['id'] = id;
  if (holder != null) jsonObject['holder'] = holder;
  if (presentationSubmission != null) {
    jsonObject['presentation_submission'] = presentationSubmission!.toJson();
  }
  if (credentialFulfillment != null) {
    jsonObject['credential_fulfillment'] = credentialFulfillment!.toJson();
  }
  if (credentialApplication != null) {
    jsonObject['credential_application'] = credentialApplication!.toJson();
  }
  if (proof != null) {
    List tmp = [];
    for (var p in proof!) {
      tmp.add(p.toJson());
    }
    jsonObject['proof'] = tmp;
  }
  return jsonObject;
}