NutritionContainerHelper class
Nutrition data, for nutrient order and conversions.
- Inheritance
-
- Object
- ChangeNotifier
- NutritionContainerHelper
- Available extensions
Constructors
- NutritionContainerHelper({required OrderedNutrients orderedNutrients, required Product product})
Properties
-
allNutrients
→ List<
OrderedNutrient> -
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- loadingRobotoffExtraction → bool
-
no setter
- noNutritionData ↔ bool
-
getter/setter pair
- perSize ↔ PerSize
-
getter/setter pair
- robotoffNutrientExtraction → RobotoffNutrientExtractionResult?
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- servingSize ↔ String
-
getter/setter pair
Methods
-
add(
OrderedNutrient orderedNutrient) → void - To be used when an OrderedNutrient is added to the input list
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object.
inherited
-
fetchRobotoffExtraction(
Product product) → Future< bool> -
getChangedProducts(
String barcode) → List< Product> - Returns the minimal products to save, with only the changed data.
-
getDisplayableNutrients(
) → Iterable< OrderedNutrient> - Returns the interesting nutrients that need to be displayed.
-
getLeftoverNutrients(
) → Iterable< OrderedNutrient> - Returns the not interesting nutrients, for a "Please add me!" list.
-
getUnit(
Nutrient nutrient) → Unit - Returns the nutrient Unit.
-
getUnits(
Nutrient nutrient) → List< Unit> -
getValue(
Nutrient nutrient) → num? - Returns the stored product nutrient's value.
-
isEditableWeight(
Unit unit) → bool - Typical use-case: should we make the Unit button clickable?
-
isEdited(
) → bool - Returns true if the user edited something.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
replaceListener(
VoidCallback listener) → void -
Available on ChangeNotifier, provided by the ChangeNotifierExtensions extension
-
setNextWeightUnit(
OrderedNutrient orderedNutrient) → void - Typical use-case: Unit button action.
-
setNutrientUnit(
Nutrient nutrient, Unit unit) → void - Stores the nutrient Unit.
-
setNutrientValueText(
Nutrient nutrient, String? text, NumberFormat numberFormat) → void - Stores the end-user input when it differs from the loaded value.
-
setServingText(
String? text) → void - Stores the text from the end-user input.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
convertWeightFromG(
double? value, Unit unit) → double? - Converts a double (weight) value from grams.
-
convertWeightToG(
double? value, Unit unit) → double? - Converts a double (weight) value from grams.
-
getNumberFormat(
String locale) → NumberFormat - Plain decimal, no exponent nor group separator.
-
getNutrient(
OrderedNutrient orderedNutrient) → Nutrient? -
Returns the Nutrient that matches the
orderedNutrient.