toJson method

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

Implementation

@override
Map<String, dynamic> toJson() {
  var jsonObject = <String, dynamic>{
    'credential_issuer': credentialIssuer,
    'credential_endpoint': credentialEndpoint
  };
  if (batchCredentialEndpoint != null) {
    jsonObject['batch_credential_endpoint'] = batchCredentialEndpoint;
  }
  if (authorizationServer != null) {
    jsonObject['authorization_server'] = authorizationServer;
  }
  if (display != null && display!.isNotEmpty) {
    var tmp = [];
    for (var d in display!) {
      tmp.add(d.toJson());
    }
    jsonObject['display'] = tmp;
  }

  if (credentialsSupported.isNotEmpty) {
    var tmp = [];
    for (var s in credentialsSupported) {
      tmp.add(s.toJson());
    }
    jsonObject['credentialSubject'] = tmp;
  }

  return jsonObject;
}