InlineMethodFeedback.fromJson constructor

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

Implementation

factory InlineMethodFeedback.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is! Map) {
    throw jsonDecoder.mismatch(jsonPath, "'inlineMethod feedback'", json);
  }
  String? className;
  if (json case {'className': var encodedClassName}) {
    className = jsonDecoder.decodeString(
      '$jsonPath.className',
      encodedClassName,
    );
  }
  String methodName;
  if (json case {'methodName': var encodedMethodName}) {
    methodName = jsonDecoder.decodeString(
      '$jsonPath.methodName',
      encodedMethodName,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'methodName'", json);
  }
  bool isDeclaration;
  if (json case {'isDeclaration': var encodedIsDeclaration}) {
    isDeclaration = jsonDecoder.decodeBool(
      '$jsonPath.isDeclaration',
      encodedIsDeclaration,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'isDeclaration'", json);
  }
  return InlineMethodFeedback(
    methodName,
    isDeclaration,
    className: className,
  );
}