PassioFoodItem class
Represents a food item with its details, amount, ingredients, and nutritional information.
Constructors
-
PassioFoodItem({required PassioFoodAmount amount, required String details, required String iconId, required String id, required List<
PassioIngredient> ingredients, required String name, required String refCode, PassioID? scannedId}) -
const
-
PassioFoodItem.fromJson(Map<
String, dynamic> json) -
Creates a
PassioFoodItem
object from a JSON map.factory
Properties
- amount → PassioFoodAmount
-
The amount of the food item including selected quantity and unit.
final
- details → String
-
Additional details about the food item.
final
- hashCode → int
-
Calculates the hash code for this
PassioFoodItem
object.no setteroverride - iconId → String
-
The ID of the icon associated with the food item.
final
- id → String
-
The unique identifier of the food item.
final
-
ingredients
→ List<
PassioIngredient> -
A list of ingredients that make up the food item.
final
- name → String
-
The name of the food item.
final
- refCode → String
-
A reference code serving as a unique identifier for the food item.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scannedId → PassioID?
-
Variable to store the final PassioID scanned during volume detection on iOS.
final
Methods
-
ingredientWeight(
) → UnitMass - Calculates the total weight of the food item by summing the weights of all ingredients.
-
isOpenFood(
) → String? - Checks if any ingredient has an open food license. Returns the license if found, otherwise returns null.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
nutrients(
UnitMass unitMass) → PassioNutrients - Calculates the nutrients based on the selected amount and unit.
-
nutrientsReference(
) → PassioNutrients - Calculates the nutrients based on a reference weight of 100 grams.
-
nutrientsSelectedSize(
) → PassioNutrients - Calculates the nutrients based on the selected size (using the selected quantity and unit).
-
toJson(
) → Map< String, dynamic> -
Converts the
PassioFoodItem
object to a JSON map. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
Compares two
PassioFoodItem
objects for equality.override