ServerStatusParams.fromJson constructor

ServerStatusParams.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json
)

Implementation

factory ServerStatusParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    AnalysisStatus? analysis;
    if (json.containsKey('analysis')) {
      analysis = AnalysisStatus.fromJson(
          jsonDecoder, '$jsonPath.analysis', json['analysis']);
    }
    PubStatus? pub;
    if (json.containsKey('pub')) {
      pub = PubStatus.fromJson(jsonDecoder, '$jsonPath.pub', json['pub']);
    }
    return ServerStatusParams(analysis: analysis, pub: pub);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'server.status params', json);
  }
}