toJson method

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

Implementation

@override
Map<String, dynamic> toJson() {
  Map<String, dynamic> jsonObject = {};
  if (fields != null) {
    List field = [];
    for (var f in fields!) {
      field.add(f.toJson());
    }
    jsonObject['fields'] = field;
  }

  if (limitDisclosure != null) {
    if (limitDisclosure == Limiting.preferred) {
      jsonObject['limit_disclosure'] = 'preferred';
    } else {
      jsonObject['limit_disclosure'] = 'required';
    }
  }

  if (subjectIsIssuer != null) {
    if (subjectIsIssuer == Limiting.preferred) {
      jsonObject['subject_is_issuer'] = 'preferred';
    } else {
      jsonObject['subject_is_issuer'] = 'required';
    }
  }

  if (isHolder != null) jsonObject['is_holder'] = isHolder!.toJson();

  if (sameSubject != null) jsonObject['same_subject'] = sameSubject!.toJson();

  if (statuses != null) jsonObject['statuses'] = statuses!.toJson();

  return jsonObject;
}