nutrients method

PassioNutrients nutrients()

Calculates the nutrients of the food item based on the current serving size.

Implementation

PassioNutrients nutrients() {
  final currentWeight = ingredientWeight();
  final ingredientNutrients = ingredients
      .map((ingredient) => (
            ingredient.referenceNutrients,
            ingredient.servingWeight() / currentWeight
          ))
      .toList();
  return PassioNutrients.fromIngredientsData(
      ingredientNutrients, currentWeight);
}