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) {
    throw jsonDecoder.mismatch(
      jsonPath,
      "'RefactoringMethodParameter'",
      json,
    );
  }
  String? id;
  if (json case {'id': var encodedId}) {
    id = jsonDecoder.decodeString('$jsonPath.id', encodedId);
  }
  RefactoringMethodParameterKind kind;
  if (json case {'kind': var encodedKind}) {
    kind = RefactoringMethodParameterKind.fromJson(
      jsonDecoder,
      '$jsonPath.kind',
      encodedKind,
      clientUriConverter: clientUriConverter,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'kind'", json);
  }
  String type;
  if (json case {'type': var encodedType}) {
    type = jsonDecoder.decodeString('$jsonPath.type', encodedType);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'type'", json);
  }
  String name;
  if (json case {'name': var encodedName}) {
    name = jsonDecoder.decodeString('$jsonPath.name', encodedName);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'name'", json);
  }
  String? parameters;
  if (json case {'parameters': var encodedParameters}) {
    parameters = jsonDecoder.decodeString(
      '$jsonPath.parameters',
      encodedParameters,
    );
  }
  return RefactoringMethodParameter(
    kind,
    type,
    name,
    id: id,
    parameters: parameters,
  );
}