class MonthTotals { Map positives; Map 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; } }