NutrimentsHelper class

Helper class for energy computations and checks

Constructors

NutrimentsHelper()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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, {PerSize perSize = PerSize.oneHundredGrams}) double?
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, {PerSize perSize = PerSize.oneHundredGrams}) bool
Checks 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 incoherent.
fromKCalToKJ(double kCal) double
fromKJtoKCal(double kJ) double