FoodRecord class

Represents a record of food items, including their ingredients, serving sizes, and other properties.

Available extensions

Constructors

FoodRecord.fromFoodRecordIngredient(FoodRecordIngredient ingredient, {PassioIDEntityType entityType = PassioIDEntityType.item})
Factory constructor to create a FoodRecord from a FoodRecordIngredient instance.
factory
FoodRecord.fromJson(Map<String, dynamic> json)
Creates a FoodRecord instance from a JSON object.
factory
FoodRecord.fromPassioFoodItem(PassioFoodItem foodItem, {PassioIDEntityType entityType = PassioIDEntityType.item})
Factory constructor to create a FoodRecord from a PassioFoodItem instance.
factory

Properties

additionalData String
Additional data for the food item.
getter/setter pair
computedWeight UnitMass
OLD STRUCTURE computedWeight is UnitMass class and contains weight.
no setter
entityType PassioIDEntityType?
Type of Passio ID entity.
getter/setter pair
hashCode int
Overrides the hashCode method.
no setteroverride
iconId String
Identifier for the food item's icon.
getter/setter pair
id String
Unique identifier for the food record.
getter/setter pair
ingredients List<FoodRecordIngredient>
List of ingredients in the food item.
getter/setter pair
isFavorite bool
Indicates whether the food record is marked as a favorite.
getter/setter pair
mealLabel ↔ MealLabel?
Label for the meal type.
getter/setter pair
name String
Name of the food item.
getter/setter pair
openFoodLicense String?
getter/setter pair
passioID String
Passio identifier for the food record.
getter/setter pair
refCode String
A reference code serving as a unique identifier for the food item.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
servingSizes List<PassioServingSize>
List of serving sizes available for the food item.
getter/setter pair
servingUnits List<PassioServingUnit>
List of serving units available for the food item.
getter/setter pair
totalAlcohol double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total alcohol content in the food record based on the selected serving size.
no setter
totalCalcium double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total calcium content in the food record based on the selected serving size.
no setter
totalCalories double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total calories in the food record based on the selected serving size.
no setter
totalCarbs double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total carbohydrates in the food record based on the selected serving size.
no setter
totalCholesterol double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total cholesterol in the food record based on the selected serving size.
no setter
totalChromium double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total chromium content in the food record based on the selected serving size.
no setter
totalFat double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total fat content in the food record based on the selected serving size.
no setter
totalFibers double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total fibers in the food record based on the selected serving size.
no setter
totalFolicAcid double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total folic acid content in the food record based on the selected serving size.
no setter
totalIodine double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total iodine content in the food record based on the selected serving size.
no setter
totalIron double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total iron content in the food record based on the selected serving size.
no setter
totalMagnesium double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total magnesium content in the food record based on the selected serving size.
no setter
totalMonounsaturatedFat double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total monounsaturated fat content in the food record based on the selected serving size.
no setter
totalPhosphorus double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total phosphorus content in the food record based on the selected serving size.
no setter
totalPolyunsaturatedFat double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total polyunsaturated fat content in the food record based on the selected serving size.
no setter
totalPotassium double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total potassium content in the food record based on the selected serving size.
no setter
totalProteins double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total protein content in the food record based on the selected serving size.
no setter
totalSatFat double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total saturated fat content in the food record based on the selected serving size.
no setter
totalSelenium double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total selenium content in the food record based on the selected serving size.
no setter
totalSodium double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total sodium content in the food record based on the selected serving size.
no setter
totalSugars double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total sugars content in the food record based on the selected serving size.
no setter
totalSugarsAdded double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total added sugars content in the food record based on the selected serving size.
no setter
totalSugarsAlcohol double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total sugar alcohol content in the food record based on the selected serving size.
no setter
totalTransFat double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total trans fat content in the food record based on the selected serving size.
no setter
totalVitaminA double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total vitamin A content in the food record based on the selected serving size.
no setter
totalVitaminB12 double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total vitamin B12 content in the food record based on the selected serving size.
no setter
totalVitaminB12Added double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total added vitamin B12 content in the food record based on the selected serving size.
no setter
totalVitaminB6 double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total vitamin B6 content in the food record based on the selected serving size.
no setter
totalVitaminC double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total vitamin C content in the food record based on the selected serving size.
no setter
totalVitaminD double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total vitamin D content in the food record based on the selected serving size.
no setter
totalVitaminE double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total vitamin E content in the food record based on the selected serving size.
no setter
totalVitaminEAdded double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total added vitamin E content in the food record based on the selected serving size.
no setter
totalVitaminKDihydrophylloquinone double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total vitamin K (dihydrophylloquinone) content in the food record based on the selected serving size.
no setter
totalVitaminKMenaquinone4 double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total vitamin K (menaquinone-4) content in the food record based on the selected serving size.
no setter
totalVitaminKPhylloquinone double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total vitamin K (phylloquinone) content in the food record based on the selected serving size.
no setter
totalZinc double

Available on FoodRecord, provided by the FoodRecordExtension extension

Retrieves the total zinc content in the food record based on the selected serving size.
no setter

Methods

addIngredient(FoodRecord record, {int index = 0}) → void
Adds an ingredient to the food record at the specified index.
calculateQuantity() → void
Calculates the quantity of the food item based on the selected serving unit.
getCreatedAt() DateTime?
getSelectedQuantity() double
Retrieves the currently selected quantity of the food item.
getSelectedUnit() String
Retrieves the currently selected unit for measurement.
ingredientWeight() UnitMass
Calculates the total weight of all ingredients in the food item.
logMeal({DateTime? dateTime}) → void
Logs the meal with the specified date and time, or defaults to the current date and time if not provided.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nutrients() PassioNutrients
Calculates the nutrients of the food item based on the current serving size.
nutrientsReference() PassioNutrients
Calculates the nutrients of the food item based on a reference serving size of 100 grams.
nutrientsSelectedSize() PassioNutrients
Calculates the nutrients of the food item based on the selected serving size.
removeIngredient(int index) → void
Removes an ingredient from the food record at the specified index.
replaceIngredient(FoodRecord newIngredient, int index) bool
Replaces an ingredient in the food record with a new ingredient at the specified index.
servingWeight() UnitMass
Calculates the serving weight of the food item based on the selected unit.
setCreatedAt(DateTime dateTime) → void
setSelectedQuantity(double quantity) → void
Sets the selected quantity for the food item and recalculates ingredient quantities accordingly.
setSelectedUnit(String unit) bool
Sets the selected unit for measurement and recalculates ingredient quantities accordingly.
setSelectedUnitKeepWeight(String unit) bool
Sets the selected unit for the food item while keeping the weight consistent.
toJson() Map<String, dynamic>
Converts the FoodRecord instance to a JSON object.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
Overrides the equality operator.
override

Constants

zeroQuantity → const double