NutrimentsHelper class

Constructors

NutrimentsHelper()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Methods

calculateEnergy(Nutriments nutriments) double
get the energy value converted in kJ if necessary. Removed as now energy is always in kJ calculates the energy for 100g in kJ. ! should be used cautiously (might not be displayed to the end user) ! source : https://en.wikipedia.org/wiki/Food_energy
checkEnergyCoherence(Nutriments nutriments, double marginPercentage) bool
check if the stated energy value is within a margin of error a use case for this is before saving a product, check if the values aren't uncoherent.
getEnergyAsKCal(Nutriments nutriments) double
normalize the energy unit as it is pretty fragmented. Removed as now energy is always in kJ get the energy value converted in kCal.