DiagnosticGetServerPortResult.fromJson constructor

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

Implementation

factory DiagnosticGetServerPortResult.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    int port;
    if (json.containsKey('port')) {
      port = jsonDecoder.decodeInt('$jsonPath.port', json['port']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'port');
    }
    return DiagnosticGetServerPortResult(port);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'diagnostic.getServerPort result', json);
  }
}