From 7eca5785cc0dcb8fcaa5ebc9e47430b92a44b7ff Mon Sep 17 00:00:00 2001 From: Polina Cherkasova Date: Wed, 17 Apr 2024 15:13:59 -0700 Subject: [PATCH] Update model.dart --- .../src/screens/memory/panes/profile/model.dart | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/devtools_app/lib/src/screens/memory/panes/profile/model.dart b/packages/devtools_app/lib/src/screens/memory/panes/profile/model.dart index 8679b1216a0..29e9fb771f6 100644 --- a/packages/devtools_app/lib/src/screens/memory/panes/profile/model.dart +++ b/packages/devtools_app/lib/src/screens/memory/panes/profile/model.dart @@ -9,6 +9,11 @@ import '../../../../shared/table/table_data.dart'; import '../../../vm_developer/vm_service_private_extensions.dart'; import '../../shared/heap/class_filter.dart'; +class _Json { + static const rootPackage = 'root'; + static const data = 'data'; +} + class AdaptedProfile { AdaptedProfile.fromAllocationProfile( AllocationProfile profile, @@ -63,6 +68,17 @@ class AdaptedProfile { ]; } + factory AdaptedProfile.fromJson(Map json) { + final profile = + AllocationProfile.fromJson(json[_Json.data] as Map); + final rootPackage = json['rootPackage'] as String?; + return AdaptedProfile.fromAllocationProfile( + profile, + ClassFilter.empty(), + rootPackage, + ); + } + /// A record per class plus one total record, with applied filter. late final List records;