Product class

This class contains most of the data about a specific product.

Please read the language mechanics explanation if you intend to display or update data in specific language: https://github.com/openfoodfacts/openfoodfacts-dart/blob/master/DOCUMENTATION.md#about-languages-mechanics

Annotations
  • @JsonSerializable()

Constructors

Product({String? barcode, String? productName, Map<OpenFoodFactsLanguage, String>? productNameInLanguages, String? genericName, String? brands, List<String>? brandsTags, String? countries, List<String>? countriesTags, Map<OpenFoodFactsLanguage, List<String>>? countriesTagsInLanguages, OpenFoodFactsLanguage? lang, String? quantity, String? imageFrontUrl, String? imageFrontSmallUrl, String? imageIngredientsUrl, String? imageIngredientsSmallUrl, String? imageNutritionUrl, String? imageNutritionSmallUrl, String? imagePackagingUrl, String? imagePackagingSmallUrl, String? servingSize, double? servingQuantity, double? packagingQuantity, List<ProductImage>? selectedImages, List<ProductImage>? images, List<Ingredient>? ingredients, String? ingredientsText, Map<OpenFoodFactsLanguage, String>? ingredientsTextInLanguages, List<String>? ingredientsTags, Map<OpenFoodFactsLanguage, List<String>>? ingredientsTagsInLanguages, IngredientsAnalysisTags? ingredientsAnalysisTags, Additives? additives, Allergens? allergens, NutrientLevels? nutrientLevels, String? nutrimentEnergyUnit, String? nutrimentDataPer, String? nutriscore, String? categories, List<String>? categoriesTags, Map<OpenFoodFactsLanguage, List<String>>? categoriesTagsInLanguages, String? labels, List<String>? labelsTags, Map<OpenFoodFactsLanguage, List<String>>? labelsTagsInLanguages, String? packaging, List<String>? packagingTags, List<String>? miscTags, List<String>? statesTags, List<String>? tracesTags, List<String>? storesTags, String? stores, List<AttributeGroup>? attributeGroups, DateTime? lastModified, String? ecoscoreGrade, double? ecoscoreScore, EcoscoreData? ecoscoreData, Nutriments? nutriments, bool? noNutritionData})
Product.fromJson(Map<String, dynamic> json)
factory

Properties

abbreviatedName String?
Abbreviated product name.
getter/setter pair
abbreviatedNameInLanguages Map<OpenFoodFactsLanguage, String>?
Localized abbreviated product name.
getter/setter pair
additives Additives?
getter/setter pair
allergens Allergens?
getter/setter pair
attributeGroups List<AttributeGroup>?
getter/setter pair
barcode String?
Barcode of the product. Will very very very often be not null.
getter/setter pair
brands String?
getter/setter pair
brandsTags List<String>?
getter/setter pair
brandsTagsInLanguages Map<OpenFoodFactsLanguage, List<String>>?
getter/setter pair
categories String?
getter/setter pair
categoriesTags List<String>?
getter/setter pair
categoriesTagsInLanguages Map<OpenFoodFactsLanguage, List<String>>?
getter/setter pair
comparedToCategory String?
getter/setter pair
countries String?
getter/setter pair
countriesTags List<String>?
getter/setter pair
countriesTagsInLanguages Map<OpenFoodFactsLanguage, List<String>>?
getter/setter pair
created DateTime?
Creation timestamp. Read-only.
getter/setter pair
creator String?
Creation user id. Read-only.
getter/setter pair
ecoscoreData EcoscoreData?
getter/setter pair
ecoscoreGrade String?
getter/setter pair
ecoscoreScore double?
getter/setter pair
editors List<String>?
Editors. Read-only.
getter/setter pair
embCodes String?
getter/setter pair
entryDates List<String>?
Entry dates tags. Read-only.
getter/setter pair
expirationDate String?
Expiration date / best before. Just a string, no format control.
getter/setter pair
genericName String?
Common name. Example: "Chocolate bar with milk and hazelnuts".
getter/setter pair
genericNameInLanguages Map<OpenFoodFactsLanguage, String>?
Localized common name.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
imageFrontSmallUrl String?
getter/setter pair
imageFrontUrl String?
getter/setter pair
imageIngredientsSmallUrl String?
getter/setter pair
imageIngredientsUrl String?
getter/setter pair
imageNutritionSmallUrl String?
getter/setter pair
imageNutritionUrl String?
getter/setter pair
imagePackagingSmallUrl String?
getter/setter pair
imagePackagingUrl String?
getter/setter pair
images List<ProductImage>?
All images in bulk. Will include "main" images and "raw" images.
getter/setter pair
imagesFreshnessInLanguages Map<OpenFoodFactsLanguage, Map<ImageField, int>>?
Images Freshness in seconds
getter/setter pair
ingredients List<Ingredient>?
getter/setter pair
ingredientsAnalysisTags IngredientsAnalysisTags?
getter/setter pair
ingredientsAnalysisTagsInLanguages Map<OpenFoodFactsLanguage, List<String>>?
getter/setter pair
ingredientsTags List<String>?
getter/setter pair
ingredientsTagsInLanguages Map<OpenFoodFactsLanguage, List<String>>?
getter/setter pair
ingredientsText String?
Ingredients, either set directly or taken from one of the localizations.
getter/setter pair
ingredientsTextInLanguages Map<OpenFoodFactsLanguage, String>?
Localized ingredients.
getter/setter pair
knowledgePanels KnowledgePanels?
getter/setter pair
labels String?
getter/setter pair
labelsTags List<String>?
getter/setter pair
labelsTagsInLanguages Map<OpenFoodFactsLanguage, List<String>>?
getter/setter pair
lang OpenFoodFactsLanguage?
getter/setter pair
lastCheckDates List<String>?
Last check dates tags. Read-only.
getter/setter pair
lastChecked DateTime?
Last check timestamp. Read-only.
getter/setter pair
lastChecker String?
Last check user id. Read-only.
getter/setter pair
lastEditDates List<String>?
Last edit dates tags. Read-only.
getter/setter pair
lastEditor String?
Last editor id. Read-only.
getter/setter pair
lastImage DateTime?
Last image timestamp. Read-only.
getter/setter pair
lastImageDates List<String>?
Last image dates tags. Read-only.
getter/setter pair
lastModified DateTime?
Latest modification timestamp. Read-only.
getter/setter pair
lastModifiedBy String?
Latest modification user id. Read-only.
getter/setter pair
manufacturingPlaces String?
getter/setter pair
miscTags List<String>?
getter/setter pair
miscTagsInLanguages Map<OpenFoodFactsLanguage, List<String>>?
getter/setter pair
noNutritionData bool?
getter/setter pair
novaGroup int?
getter/setter pair
nutrientLevels NutrientLevels?
getter/setter pair
nutrimentDataPer String?
Size of the product sample for "nutrition data for product as sold".
getter/setter pair
nutrimentEnergyUnit String?
getter/setter pair
nutriments Nutriments?
getter/setter pair
nutriscore String?
getter/setter pair
nutritionData bool?
Is the "nutrition data for product as sold" in the nutriment fields?
getter/setter pair
obsolete bool?
Is the product obsolete?
getter/setter pair
origins String?
getter/setter pair
packaging String?
getter/setter pair
packagingQuantity double?
getter/setter pair
packagings List<ProductPackaging>?
getter/setter pair
packagingsComplete bool?
Is the "packagings" complete?
getter/setter pair
packagingTags List<String>?
getter/setter pair
packagingTextInLanguages Map<OpenFoodFactsLanguage, String>?
getter/setter pair
productName String?
Product name, either set directly or taken from one of the localizations.
getter/setter pair
productNameInLanguages Map<OpenFoodFactsLanguage, String>?
Localized product name.
getter/setter pair
quantity String?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedImages List<ProductImage>?
cause nesting is sooo cool ;)
getter/setter pair
servingQuantity double?
getter/setter pair
servingSize String?
getter/setter pair
statesTags List<String>?
getter/setter pair
statesTagsInLanguages Map<OpenFoodFactsLanguage, List<String>>?
getter/setter pair
stores String?
getter/setter pair
storesTags List<String>?
getter/setter pair
storesTagsInLanguages Map<OpenFoodFactsLanguage, List<String>>?
getter/setter pair
tracesTags List<String>?
getter/setter pair
tracesTagsInLanguages Map<OpenFoodFactsLanguage, List<String>>?
getter/setter pair
website String?
Link to the product page on the official site of the producer
getter/setter pair

Methods

getAttribute(String attributeId) Attribute?
Returns the product attribute matching an attribute id.
getAttributes(List<String> attributeIds) Map<String, Attribute>
Returns all existing product attributes matching a list of attribute ids.
getBestProductName(OpenFoodFactsLanguage language) String
Returns the best version of a product name.
getFirstBrand() String?
Returns the first of all brands.
getMainImages() List<ProductImage>?
"Main" images: the selected images for certain criteria.
getProductImprovements() Set<ProductImprovement>
Returns all the potential improvements given the quality of the data
getProductNameBrand(OpenFoodFactsLanguage language, String separator) String
Returns a combo of the best product name and the first brand.
getProductNameBrandQuantity(OpenFoodFactsLanguage language, String separator) String
Returns a combo of best product name, first brand and quantity.
getRawImages() List<ProductImage>?
"Raw" (uploaded) images: for example "picture 12" resized to "400" size.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toData() Map<String, String>
inherited
toJson() Map<String, dynamic>
toServerData() Map<String, String>
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