In the Workout class below, I'd like to initialize avgCalorieBurn to be the average of calorie burn for each exercise inside that class. Is there a way to do this?
class Wourkout {
List<Exercise> exercises;
int? avgCalorieBurn;
Wourkout({required this.exercises, this.avgCalorieBurn});
}
class Exercise {
int calorieBurn;
Exercise({required this.calorieBurn});
}