InlineLocalVariableFeedback.fromJson constructor

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

Implementation

factory InlineLocalVariableFeedback.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is! Map) {
    throw jsonDecoder.mismatch(
      jsonPath,
      "'inlineLocalVariable feedback'",
      json,
    );
  }
  String name;
  if (json case {'name': var encodedName}) {
    name = jsonDecoder.decodeString('$jsonPath.name', encodedName);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'name'", json);
  }
  int occurrences;
  if (json case {'occurrences': var encodedOccurrences}) {
    occurrences = jsonDecoder.decodeInt(
      '$jsonPath.occurrences',
      encodedOccurrences,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'occurrences'", json);
  }
  return InlineLocalVariableFeedback(name, occurrences);
}