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;
  if (id != null) jsonObject['id'] = id;
  jsonObject['type'] = type;
  jsonObject['credentialSubject'] = credentialSubject;
  jsonObject['issuer'] = issuer;
  jsonObject['issuanceDate'] = issuanceDate.toUtc().toIso8601String();
  if (expirationDate != null) {
    jsonObject['expirationDate'] = expirationDate!.toUtc().toIso8601String();
  }
  if (proof != null) jsonObject['proof'] = proof!.toJson();
  if (status != null) jsonObject['credentialStatus'] = status!.toJson();
  if (credentialSchema != null) {
    jsonObject['credentialSchema'] = credentialSchema!.toJson();
  }

  return jsonObject;
}