HoverInformation.fromJson constructor
HoverInformation.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory HoverInformation.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
int offset;
if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'offset');
}
int length;
if (json.containsKey('length')) {
length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'length');
}
String? containingLibraryPath;
if (json.containsKey('containingLibraryPath')) {
containingLibraryPath = jsonDecoder.decodeString(
'$jsonPath.containingLibraryPath', json['containingLibraryPath']);
}
String? containingLibraryName;
if (json.containsKey('containingLibraryName')) {
containingLibraryName = jsonDecoder.decodeString(
'$jsonPath.containingLibraryName', json['containingLibraryName']);
}
String? containingClassDescription;
if (json.containsKey('containingClassDescription')) {
containingClassDescription = jsonDecoder.decodeString(
'$jsonPath.containingClassDescription',
json['containingClassDescription']);
}
String? dartdoc;
if (json.containsKey('dartdoc')) {
dartdoc =
jsonDecoder.decodeString('$jsonPath.dartdoc', json['dartdoc']);
}
String? elementDescription;
if (json.containsKey('elementDescription')) {
elementDescription = jsonDecoder.decodeString(
'$jsonPath.elementDescription', json['elementDescription']);
}
String? elementKind;
if (json.containsKey('elementKind')) {
elementKind = jsonDecoder.decodeString(
'$jsonPath.elementKind', json['elementKind']);
}
bool? isDeprecated;
if (json.containsKey('isDeprecated')) {
isDeprecated = jsonDecoder.decodeBool(
'$jsonPath.isDeprecated', json['isDeprecated']);
}
String? parameter;
if (json.containsKey('parameter')) {
parameter =
jsonDecoder.decodeString('$jsonPath.parameter', json['parameter']);
}
String? propagatedType;
if (json.containsKey('propagatedType')) {
propagatedType = jsonDecoder.decodeString(
'$jsonPath.propagatedType', json['propagatedType']);
}
String? staticType;
if (json.containsKey('staticType')) {
staticType = jsonDecoder.decodeString(
'$jsonPath.staticType', json['staticType']);
}
return HoverInformation(offset, length,
containingLibraryPath: containingLibraryPath,
containingLibraryName: containingLibraryName,
containingClassDescription: containingClassDescription,
dartdoc: dartdoc,
elementDescription: elementDescription,
elementKind: elementKind,
isDeprecated: isDeprecated,
parameter: parameter,
propagatedType: propagatedType,
staticType: staticType);
} else {
throw jsonDecoder.mismatch(jsonPath, 'HoverInformation', json);
}
}