OpenFoodAPIClient class
Client calls of the Open Food Facts API
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
-
addProductImage(
User user, SendImage image, {UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Status> - Send one image to the server. The image will be added to the product specified in the SendImage Returns a Status object as result.
-
extractIngredients(
User user, String barcode, OpenFoodFactsLanguage language, {OcrField ocrField = OcrField.GOOGLE_CLOUD_VISION, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< OcrIngredientsResult> - Extract the ingredients from image with the given parameters. The ingredients' language should be given (ingredients_fr, ingredients_de, ingredients_en)
-
extractPackaging(
User user, String barcode, OpenFoodFactsLanguage language, {OcrField ocrField = OcrField.GOOGLE_CLOUD_VISION, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< OcrPackagingResult> - Extracts the text from packaging image with OCR.
-
getCrowdinUri(
OpenFoodFactsLanguage language) → Uri -
Returns the URI to the crowdin page for a
language
. Crowdin is used in used in the official open food facts app for translating the app -
getOldProduct(
ProductQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< OldProductResult> - Returns the product for the given barcode, with an old syntax.
-
getOrderedNutrients(
{required OpenFoodFactsCountry country, required OpenFoodFactsLanguage language, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< OrderedNutrients> - Returns the nutrient hierarchy specific to a country, localized.
-
getOrderedNutrientsJsonString(
{required OpenFoodFactsCountry country, required OpenFoodFactsLanguage language, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< String> - Returns the nutrient hierarchy specific to a country, localized, as JSON Use OpenFoodAPIClient.getOrderedNutrients to get them as a OrderedNutrient object.
-
getProductFreshness(
{required List< String> barcodes, required ProductQueryVersion version, User? user, OpenFoodFactsLanguage? language, OpenFoodFactsCountry? country, UriProductHelper uriHelper = uriHelperFoodProd}) → Future<Map< String, ProductFreshness> > -
Returns the ProductFreshness for all the
barcodes
. -
getProductImageIds(
String barcode, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< List< int> > - Returns the ids of all uploaded images for that product.
-
getProductString(
ProductQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< String> - Returns the response body of "get product" API for the given barcode.
-
getProductUri(
String barcode, {OpenFoodFactsLanguage? language, OpenFoodFactsCountry? country, UriProductHelper uriHelper = uriHelperFoodProd, required bool replaceSubdomain}) → Uri - Returns the URI to the product page on a website
-
getProductV3(
ProductQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< ProductResultV3> -
The
ProductResultV3
does not contain a product, if the product is not available. ingredients, images and product name will be prepared for the given language. -
getSuggestions(
TagType taxonomyType, {String input = '', required OpenFoodFactsLanguage language, OpenFoodFactsCountry? country, String? categories, String? shape, int limit = 25, UriProductHelper uriHelper = uriHelperFoodProd, User? user}) → Future< List< String> > - cf. https://openfoodfacts.github.io/openfoodfacts-server/reference/api-v3/#get-/api/v3/taxonomy_suggestions
-
getTaxonomy<
T extends JsonObject, F extends Enum> (TaxonomyQueryConfiguration< T, F> configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future<Map< String, T> ?> -
getTaxonomyAdditives(
TaxonomyAdditiveQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyAdditive> ?> -
getTaxonomyAllergens(
TaxonomyAllergenQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyAllergen> ?> -
getTaxonomyCategories(
TaxonomyCategoryQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyCategory> ?> -
getTaxonomyCountries(
TaxonomyCountryQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyCountry> ?> -
getTaxonomyIngredients(
TaxonomyIngredientQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyIngredient> ?> -
getTaxonomyLabels(
TaxonomyLabelQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyLabel> ?> -
getTaxonomyLanguages(
TaxonomyLanguageQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyLanguage> ?> -
getTaxonomyNova(
TaxonomyNovaQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyNova> ?> -
getTaxonomyOrigins(
TaxonomyOriginQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyOrigin> ?> -
getTaxonomyPackagingMaterials(
TaxonomyPackagingMaterialQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyPackagingMaterial> ?> -
getTaxonomyPackagingRecycling(
TaxonomyPackagingRecyclingQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyPackagingRecycling> ?> -
getTaxonomyPackagings(
TaxonomyPackagingQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyPackaging> ?> -
getTaxonomyPackagingShapes(
TaxonomyPackagingShapeQueryConfiguration configuration, {User? user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< Map< String, TaxonomyPackagingShape> ?> -
getTaxonomyTranslationUri(
TagType taxonomyTagType, {required OpenFoodFactsLanguage language, UriProductHelper uriHelper = uriHelperFoodProd, bool replaceSubdomain = true}) → Uri - Returns the URI to the translation page for a taxonomy.
-
login2(
User user, {UriProductHelper uriHelper = uriHelperFoodProd}) → Future< LoginStatus?> - Logs in and returns data about the user if relevant.
-
register(
{required User user, required String name, required String email, String? orgName, bool newsletter = true, OpenFoodFactsLanguage? language, OpenFoodFactsCountry? country, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< SignUpStatus> - Creates a new user
-
resetPassword(
String emailOrUserID, {UriProductHelper uriHelper = uriHelperFoodProd, OpenFoodFactsLanguage? language, OpenFoodFactsCountry? country}) → Future< Status> - Uses reset_password.pl to send a password reset Email
-
saveProduct(
User user, Product product, {UriProductHelper uriHelper = uriHelperFoodProd, OpenFoodFactsCountry? country, OpenFoodFactsLanguage? language}) → Future< Status> - Add the given product to the database.
-
searchProducts(
User? user, AbstractQueryConfiguration configuration, {UriProductHelper uriHelper = uriHelperFoodProd}) → Future< SearchResult> - Search the OpenFoodFacts product database with the given parameters. Returns the list of products as SearchResult. Query the language specific host from OpenFoodFacts.
-
setProductImageAngle(
{required String barcode, required ImageField imageField, required OpenFoodFactsLanguage language, required String imgid, required ImageAngle angle, required User user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< String?> - Rotates a product image from an already uploaded image.
-
setProductImageCrop(
{required String barcode, required ImageField imageField, required OpenFoodFactsLanguage language, required String imgid, required int x1, required int y1, required int x2, required int y2, required User user, ImageAngle angle = ImageAngle.NOON, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< String?> - Crops an already uploaded image.
-
temporarySaveProductV3(
User user, String barcode, {List< ProductPackaging> ? packagings, bool? packagingsComplete, UriProductHelper uriHelper = uriHelperFoodProd, OpenFoodFactsCountry? country, OpenFoodFactsLanguage? language}) → Future<ProductResultV3> - Temporary: saves product packagings V3 style.
-
unselectProductImage(
{required String barcode, required ImageField imageField, required OpenFoodFactsLanguage language, required User user, UriProductHelper uriHelper = uriHelperFoodProd}) → Future< void> - Unselect a product image.
Constants
- USER_NAME_MAX_LENGTH → const int
- A username may not exceed 20 characters