RefactoringProblem.fromJson constructor

RefactoringProblem.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json, {
  4. ClientUriConverter? clientUriConverter,
})

Implementation

factory RefactoringProblem.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is! Map) {
    throw jsonDecoder.mismatch(jsonPath, "'RefactoringProblem'", json);
  }
  RefactoringProblemSeverity severity;
  if (json case {'severity': var encodedSeverity}) {
    severity = RefactoringProblemSeverity.fromJson(
      jsonDecoder,
      '$jsonPath.severity',
      encodedSeverity,
      clientUriConverter: clientUriConverter,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'severity'", json);
  }
  String message;
  if (json case {'message': var encodedMessage}) {
    message = jsonDecoder.decodeString('$jsonPath.message', encodedMessage);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'message'", json);
  }
  Location? location;
  if (json case {'location': var encodedLocation}) {
    location = Location.fromJson(
      jsonDecoder,
      '$jsonPath.location',
      encodedLocation,
      clientUriConverter: clientUriConverter,
    );
  }
  return RefactoringProblem(severity, message, location: location);
}