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