AnalysisGetHoverResult.fromJson constructor

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

Implementation

factory AnalysisGetHoverResult.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    List<HoverInformation> hovers;
    if (json.containsKey('hovers')) {
      hovers = jsonDecoder.decodeList(
          '$jsonPath.hovers',
          json['hovers'],
          (String jsonPath, Object? json) =>
              HoverInformation.fromJson(jsonDecoder, jsonPath, json));
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'hovers');
    }
    return AnalysisGetHoverResult(hovers);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'analysis.getHover result', json);
  }
}