PassioFoodAmount class
Represents the amount of a food item, including selected quantity and unit, serving sizes, and serving units.
Constructors
-
PassioFoodAmount({required double selectedQuantity, required String selectedUnit, required List<
PassioServingSize> servingSizes, required List<PassioServingUnit> servingUnits}) -
Creates a new
PassioFoodAmount
object. -
PassioFoodAmount.fromJson(Map<
String, dynamic> json) -
Creates a
PassioFoodAmount
object from a JSON map.factory
Properties
- hashCode → int
-
Calculates the hash code for this
PassioFoodAmount
object.no setteroverride - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedQuantity ↔ double
-
The selected quantity of the food item.
getter/setter pair
- selectedUnit ↔ String
-
The selected unit of measurement for the quantity.
getter/setter pair
-
servingSizes
→ List<
PassioServingSize> -
A list of available serving sizes for the food item.
final
-
servingUnits
→ List<
PassioServingUnit> -
A list of available serving units for the food item.
final
Methods
-
copyWith(
{double? selectedQuantity, String? selectedUnit}) → PassioFoodAmount -
Creates a copy of this
PassioFoodAmount
object with optional new values for its properties. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Converts the
PassioFoodAmount
object to a JSON map. -
toString(
) → String -
A string representation of this object.
inherited
-
weight(
) → UnitMass - Calculates the weight of the selected quantity in grams.
Operators
-
operator ==(
Object other) → bool -
Compares two
PassioFoodAmount
objects for equality.override