Files
Krezus/lib/domains/charts/models/month_totals.dart
2024-02-11 22:49:57 +01:00

29 lines
611 B
Dart

class MonthTotals {
Map<String, double> positives;
Map<String, double> negatives;
MonthTotals({
required this.positives,
required this.negatives,
});
double maxValue() {
double max = 0.0;
if (positives.isNotEmpty) {
double localMax = positives.values.reduce((value, element) => value + element);
if (localMax > max) {
max = localMax;
}
}
if (negatives.isNotEmpty) {
double localMax2 = negatives.values.reduce((value, element) => value + element);
if (localMax2 > max) {
max = localMax2;
}
}
return max;
}
}