TypeHierarchyItem.fromJson constructor
TypeHierarchyItem.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory TypeHierarchyItem.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
Element classElement;
if (json.containsKey('classElement')) {
classElement = Element.fromJson(
jsonDecoder, '$jsonPath.classElement', json['classElement']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'classElement');
}
String? displayName;
if (json.containsKey('displayName')) {
displayName = jsonDecoder.decodeString(
'$jsonPath.displayName', json['displayName']);
}
Element? memberElement;
if (json.containsKey('memberElement')) {
memberElement = Element.fromJson(
jsonDecoder, '$jsonPath.memberElement', json['memberElement']);
}
int? superclass;
if (json.containsKey('superclass')) {
superclass =
jsonDecoder.decodeInt('$jsonPath.superclass', json['superclass']);
}
List<int> interfaces;
if (json.containsKey('interfaces')) {
interfaces = jsonDecoder.decodeList(
'$jsonPath.interfaces', json['interfaces'], jsonDecoder.decodeInt);
} else {
throw jsonDecoder.mismatch(jsonPath, 'interfaces');
}
List<int> mixins;
if (json.containsKey('mixins')) {
mixins = jsonDecoder.decodeList(
'$jsonPath.mixins', json['mixins'], jsonDecoder.decodeInt);
} else {
throw jsonDecoder.mismatch(jsonPath, 'mixins');
}
List<int> subclasses;
if (json.containsKey('subclasses')) {
subclasses = jsonDecoder.decodeList(
'$jsonPath.subclasses', json['subclasses'], jsonDecoder.decodeInt);
} else {
throw jsonDecoder.mismatch(jsonPath, 'subclasses');
}
return TypeHierarchyItem(classElement,
displayName: displayName,
memberElement: memberElement,
superclass: superclass,
interfaces: interfaces,
mixins: mixins,
subclasses: subclasses);
} else {
throw jsonDecoder.mismatch(jsonPath, 'TypeHierarchyItem', json);
}
}