Nutriments class

Values in nutrients.

Most interesting methods are:

Inheritance
Annotations
  • @Deprecated('Use nutrition and API V3.5+ instead')

Constructors

Nutriments.empty()
Empty nutrient map.
Nutriments.fromJson(Map<String, dynamic> json)
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
jsonMap → Map<String, dynamic>
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

asSaveProductMap() → Map<String, String>
Transform the nutriments into a useful map for saving a product.
deleteValue(Nutrient nutrient, PerSize perSize) → Nutriments
Deletes the value in grams of that nutrient for that perSize.
getComputedKJ(PerSize perSize) → double?
Returns the energy in kJ for that perSize, direct or computed from kcal.
getModifier(Nutrient nutrient) → NutrientModifier?
Returns the modifier of that nutrient.
getValue(Nutrient nutrient, PerSize perSize) → double?
Returns the value of that nutrient for that perSize.
isEmpty({bool isNullEmpty = false}) → bool
Returns true if there are no populated nutrients at all.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setValue(Nutrient nutrient, PerSize perSize, double? value, {NutrientModifier? modifier}) → Nutriments
Sets the value in grams of that nutrient for that perSize.
toData() → Map<String, String>
inherited
toJson() → Map<String, dynamic>
inherited
toString() → String
A string representation of this object.
inherited
toValueString() → String
Returns all values as a String separated by a hyphen value1 - value2 - value3
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

toJsonHelper(Nutriments? n) → Map<String, dynamic>