analyzeObject2Node method
Implementation
@override
Future<RetainingNode?> analyzeObject2Node(
LeakAnalyzer analyzer, RetainingObject object) async {
InstanceRef instanceRef = object.value as InstanceRef;
final String name = instanceRef.classRef?.name ?? '';
Class? clz;
if (instanceRef.classRef?.id != null) {
clz = (await analyzer._getObjInstanceById(instanceRef.classRef!.id!))
as Class?;
}
SourceCodeLocation? sourceCodeLocation;
if (object.parentField != null && clz != null) {
sourceCodeLocation =
await LeakAnalyzer._getSourceCodeLocation(object.parentField!, clz);
}
String? toString;
if (instanceRef.id != null) {
toString = await analyzer._invokeMethod(instanceRef.id!, 'toString', []);
}
String? keyInfo = await LeakAnalyzer._map2String(object);
ClosureInfo? closureInfo;
if (object.value!.json != null) {
closureInfo = await LeakAnalyzer._getClosureInfo(
Instance.parse(object.value!.json!));
}
return RetainingNode(
name,
parentField: object.parentField?.toString(),
parentIndex: object.parentListIndex,
parentKey: keyInfo,
libraries: clz?.library?.uri,
sourceCodeLocation: sourceCodeLocation,
closureInfo: closureInfo,
string: toString,
leakedNodeType: await LeakAnalyzer._getObjectType(clz),
);
}