toJson method

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

Implementation

@override
Map<String, dynamic> toJson() {
  Map<String, dynamic> jsonObject = {'format': format, 'type': type};
  if (id != null) {
    jsonObject['id'] = id;
  }
  if (cryptographicSuitesSupported != null) {
    jsonObject['cryptographic_suites_supported'] =
        cryptographicSuitesSupported;
  }
  if (cryptographicBindingMethods != null) {
    jsonObject['cryptographic_binding_methods_supported'] =
        cryptographicBindingMethods;
  }
  if (context != null) {
    jsonObject['context'] = context;
  }
  if (order != null) {
    jsonObject['order'] = order;
  }
  if (display != null && display!.isNotEmpty) {
    var tmp = [];
    for (var d in display!) {
      tmp.add(d.toJson());
    }
    jsonObject['display'] = tmp;
  }
  if (credentialSubject != null) {
    var tmp = <String, dynamic>{};
    credentialSubject!.forEach((key, value) {
      tmp[key] = value.toJson();
    });
    jsonObject['credentialSubject'] = tmp;
  }
  return jsonObject;
}