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) {
    String? className;
    if (json.containsKey('className')) {
      className = jsonDecoder.decodeString(
        '$jsonPath.className',
        json['className'],
      );
    }
    String methodName;
    if (json.containsKey('methodName')) {
      methodName = jsonDecoder.decodeString(
        '$jsonPath.methodName',
        json['methodName'],
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'methodName');
    }
    bool isDeclaration;
    if (json.containsKey('isDeclaration')) {
      isDeclaration = jsonDecoder.decodeBool(
        '$jsonPath.isDeclaration',
        json['isDeclaration'],
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'isDeclaration');
    }
    return InlineMethodFeedback(
      methodName,
      isDeclaration,
      className: className,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'inlineMethod feedback', json);
  }
}