upgradeToVersion method
Implementation
@override
Map<String, dynamic> upgradeToVersion(
Map<String, dynamic> payload,
int oldVersion,
) {
assert(oldVersion < version);
assert(oldVersion == 1);
final updatedPayload = Map<String, dynamic>.of(payload);
updatedPayload['version'] = version;
final oldData = payload['data'];
updatedPayload['data'] = [
for (final data in oldData)
{
'type': 'ClassHeapStats',
'class': <String, dynamic>{
'type': '@Class',
...data['class'],
},
'bytesCurrent': data['bytesCurrent'],
'accumulatedSize': data['bytesDelta'],
'instancesCurrent': data['instancesCurrent'],
'instancesAccumulated': data['instancesDelta'],
// new and old space data is just reported as a list of ints
'_new': <int>[
// # of instances in new space.
data['instancesCurrent'],
// shallow memory consumption in new space.
data['bytesCurrent'],
// external memory consumption.
0,
],
// We'll just fudge the old space numbers.
'_old': const <int>[0, 0, 0],
},
];
return updatedPayload;
}