PresentationDefinitionWithOptions.fromJson constructor

PresentationDefinitionWithOptions.fromJson(
  1. dynamic jsonObject
)

Implementation

PresentationDefinitionWithOptions.fromJson(dynamic jsonObject) {
  var object = credentialToMap(jsonObject);
  if (object.containsKey('options')) {
    Map<String, dynamic> options = object['options'];

    if (options.containsKey('domain')) {
      domain = options['domain'];
    } else {
      throw FormatException('Options Object us contain domain property');
    }
    if (options.containsKey('challenge')) {
      challenge = options['challenge'];
    } else {
      throw FormatException('Options Object must contain challenge property');
    }
  } else {
    throw FormatException('options object needed');
  }
  if (object.containsKey('presentation_definition')) {
    presentationDefinition =
        PresentationDefinition.fromJson(object['presentation_definition']);
  } else {
    throw Exception('presentation_definition needed');
  }
}