RefactoringMethodParameter.fromJson constructor

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

Implementation

factory RefactoringMethodParameter.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is Map) {
    String? id;
    if (json.containsKey('id')) {
      id = jsonDecoder.decodeString('$jsonPath.id', json['id']);
    }
    RefactoringMethodParameterKind kind;
    if (json.containsKey('kind')) {
      kind = RefactoringMethodParameterKind.fromJson(
        jsonDecoder,
        '$jsonPath.kind',
        json['kind'],
        clientUriConverter: clientUriConverter,
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'kind');
    }
    String type;
    if (json.containsKey('type')) {
      type = jsonDecoder.decodeString('$jsonPath.type', json['type']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'type');
    }
    String name;
    if (json.containsKey('name')) {
      name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'name');
    }
    String? parameters;
    if (json.containsKey('parameters')) {
      parameters = jsonDecoder.decodeString(
        '$jsonPath.parameters',
        json['parameters'],
      );
    }
    return RefactoringMethodParameter(
      kind,
      type,
      name,
      id: id,
      parameters: parameters,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'RefactoringMethodParameter', json);
  }
}