ProblemReport.fromJson constructor

ProblemReport.fromJson(
  1. dynamic jsonObject
)

Implementation

ProblemReport.fromJson(super.jsonObject) : super.fromJson() {
  if (![
    DidcommMessages.problemReport,
    DidcommMessages.issueCredentialProblem,
    DidcommMessages.requestPresentationProblem
  ].contains(type)) {
    throw Exception('Wrong message type');
  }
  if (body.containsKey('code')) {
    code = body['code'];
  } else {
    throw FormatException('code property is needed in Problem Report');
  }
  comment = body['comment'];
  args = body['args'];
  escalateTo = body['escalate_to'];
}