StatusObject.fromJson constructor

StatusObject.fromJson(
  1. dynamic statusInput
)

Implementation

StatusObject.fromJson(dynamic statusInput) {
  Map<String, dynamic> stat = credentialToMap(statusInput);
  if (stat.containsKey('active')) {
    active = _determineDirective(stat['active']['directive']);
  }
  if (stat.containsKey('suspended')) {
    suspended = _determineDirective(stat['suspended']['directive']);
  }
  if (stat.containsKey('revoked')) {
    revoked = _determineDirective(stat['revoked']['directive']);
  }

  if (revoked == null && suspended == null && active == null) {
    throw FormatException(
        'One property out of active, revoked and suspended must be given');
  }
}