InputDescriptor.fromJson constructor

InputDescriptor.fromJson(
  1. dynamic inputDescriptorJson
)

Implementation

InputDescriptor.fromJson(dynamic inputDescriptorJson) {
  var input = credentialToMap(inputDescriptorJson);
  if (input.containsKey('id')) {
    id = input['id'];
  } else {
    throw FormatException('Input descriptor needs id property');
  }

  if (input.containsKey('name')) name = input['name'];
  if (input.containsKey('purpose')) purpose = input['purpose'];
  if (input.containsKey('constraints')) {
    constraints = InputDescriptorConstraints.fromJson(input['constraints']);
  }
  if (input.containsKey('group')) group = input['group'].cast<String>();
}