CredentialApplication.fromJson constructor

CredentialApplication.fromJson(
  1. dynamic jsonObject
)

Implementation

CredentialApplication.fromJson(dynamic jsonObject) {
  var map = credentialToMap(jsonObject);
  if (map.containsKey('id')) {
    id = map['id'];
  } else {
    throw Exception('id property needed in Credential application');
  }

  specVersion = map['spec_version'] ??
      'https://identity.foundation/credential-manifest/spec/v0.0.0/';
  if (map.containsKey('manifest_id')) {
    manifestId = map['manifest_id'];
  } else {
    throw Exception('manifest_id property needed in Credential application');
  }

  if (map.containsKey('format')) {
    format = FormatProperty.fromJson(map['format']);
  } else {
    throw Exception('format property needed in credential Application');
  }

  if (map.containsKey('presentation_submission')) {
    presentationSubmission =
        PresentationSubmission.fromJson(map['presentation_submission']);
  }
}