@@ -13,9 +13,11 @@ abstract class AnalysisUnitsInterface implements Encodable {
1313 String get batteryTemperature;
1414
1515 String get cpuFrequency;
16+ String get cpuUsagePercents;
1617 String get cpuTemperature;
1718
1819 MemVolUnit get ramConsumption;
20+ String get ramConsumptionPercents;
1921
2022 MemVolUnit get trafficConsumption;
2123}
@@ -26,8 +28,6 @@ class AnalysisUnits implements AnalysisUnitsInterface {
2628 required this .batteryTemperature,
2729 required this .cpuFrequency,
2830 required this .cpuTemperature,
29- required this .ramConsumption,
30- required this .trafficConsumption,
3131 });
3232
3333 factory AnalysisUnits .fromMap (Map <String , dynamic > map) {
@@ -36,8 +36,6 @@ class AnalysisUnits implements AnalysisUnitsInterface {
3636 batteryTemperature: map['batteryTemperature' ],
3737 cpuFrequency: map['cpuFrequency' ],
3838 cpuTemperature: map['cpuTemperature' ],
39- ramConsumption: MemVolUnit (),
40- trafficConsumption: MemVolUnit (),
4139 );
4240 }
4341
@@ -49,23 +47,31 @@ class AnalysisUnits implements AnalysisUnitsInterface {
4947 @override
5048 final String cpuFrequency;
5149 @override
50+ String get cpuUsagePercents => '%' ;
51+ @override
5252 final String cpuTemperature;
5353
5454 @override
55- final MemVolUnit ramConsumption;
55+ MemVolUnit get ramConsumption => MemVolUnit ();
56+ @override
57+ String get ramConsumptionPercents => '%' ;
5658
5759 @override
58- final MemVolUnit trafficConsumption;
60+ MemVolUnit get trafficConsumption => MemVolUnit () ;
5961
6062 @override
61- Map <String , dynamic > toMap () {
63+ Map <String , dynamic > toMap ({ bool full = false } ) {
6264 return {
6365 'batteryLevel' : batteryLevel,
6466 'batteryTemperature' : batteryTemperature,
6567 'cpuFrequency' : cpuFrequency,
6668 'cpuTemperature' : cpuTemperature,
67- 'ramConsumption' : ramConsumption.toString (),
68- 'trafficConsumption' : trafficConsumption.toString (),
69+ if (full) ...{
70+ 'cpuUsagePercents' : cpuUsagePercents,
71+ 'ramConsumption' : ramConsumption.toString (),
72+ 'ramConsumptionPercents' : ramConsumptionPercents,
73+ 'trafficConsumption' : trafficConsumption.toString (),
74+ },
6975 };
7076 }
7177
0 commit comments