setCarbsPercentage method
Sets the percentage of carbohydrates in the diet and adjusts other nutrient percentages to maintain balance.
Implementation
void setCarbsPercentage(int carbs) {
final values = (balance3Values(
first: carbs, second: proteinPercentage, third: fatPercentage));
// Set the new percentage of carbohydrates.
carbsPercentage = values.$1;
// Set the adjusted percentage of protein.
proteinPercentage = values.$2;
// Set the adjusted percentage of fat.
fatPercentage = values.$3;
}