Skip to content

Commit

Permalink
Update model.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
polina-c committed Apr 17, 2024
1 parent c004a97 commit 7eca578
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -63,6 +68,17 @@ class AdaptedProfile {
];
}

factory AdaptedProfile.fromJson(Map<String, dynamic> json) {
final profile =
AllocationProfile.fromJson(json[_Json.data] as Map<String, dynamic>);
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<ProfileRecord> records;

Expand Down

0 comments on commit 7eca578

Please sign in to comment.