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) {
    String name;
    if (json.containsKey('name')) {
      name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'name');
    }
    int occurrences;
    if (json.containsKey('occurrences')) {
      occurrences = jsonDecoder.decodeInt(
        '$jsonPath.occurrences',
        json['occurrences'],
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'occurrences');
    }
    return InlineLocalVariableFeedback(name, occurrences);
  } else {
    throw jsonDecoder.mismatch(
      jsonPath,
      'inlineLocalVariable feedback',
      json,
    );
  }
}