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, {QueryType? queryType}) 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, QueryType? queryType}) Future<OcrIngredientsResult>
Extract the ingredients from image with the given parameters. The ingredients language should be given (ingredients_fr, ingredients_de, ingredients_en) Returns the ingredients using OCR. By default the query will use the Google Cloud Vision.
extractPackaging(User user, String barcode, OpenFoodFactsLanguage language, {OcrField ocrField = OcrField.GOOGLE_CLOUD_VISION, QueryType? queryType}) Future<OcrPackagingResult>
Extracts the text from packaging image with OCR.
getAutocompletedSuggestions(TagType taxonomyType, {String input = '', OpenFoodFactsLanguage language = OpenFoodFactsLanguage.ENGLISH, QueryType? queryType, int limit = 25}) Future<List>
Returns suggestions.
getCrowdinUri(OpenFoodFactsLanguage language) Uri
Returns the URI to the crowdin page for a language.
getEcoscoreHtmlDescription(String barcode, OpenFoodFactsLanguage language, {QueryType? queryType}) Future<String?>
Returns the Ecoscore description in HTML
getIngredientSpellingCorrection({String? ingredientName, Product? product, User? user, QueryType? queryType}) Future<SpellingCorrection?>
getKnowledgePanels(ProductQueryConfiguration configuration, QueryType queryType) Future<KnowledgePanels>
Returns all KnowledgePanels for a product.
getOrderedNutrients({required String cc, required OpenFoodFactsLanguage language, QueryType? queryType}) Future<OrderedNutrients>
Returns the nutrient hierarchy specific to a country, localized.
getOrderedNutrientsJsonString({required OpenFoodFactsCountry country, required OpenFoodFactsLanguage language, QueryType? queryType}) Future<String>
Returns the nutrient hierarchy specific to a country, localized, as JSON
getProduct(ProductQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<ProductResult>
Returns the product for the given barcode. The ProductResult does not contain a product, if the product is not available. ingredients, images and product name will be prepared for the given language.
getProductFreshness({required List<String> barcodes, User? user, OpenFoodFactsLanguage? language, OpenFoodFactsCountry? country, QueryType? queryType}) Future<Map<String, ProductFreshness>>
Returns the ProductFreshness for all the barcodes.
getProductInsights(String barcode, User user, {QueryType? queryType}) Future<InsightsResult>
getProductList(User? user, ProductListQueryConfiguration configuration, {QueryType? queryType}) Future<SearchResult>
Search the OpenFoodFacts product database: multiple barcodes in input.
getProductRaw(String barcode, OpenFoodFactsLanguage language, {User? user, QueryType? queryType}) Future<ProductResult>
Returns the product for the given barcode. The ProductResult does not contain a product, if the product is not available. No parsing of ingredients. No adjustment by language. No replacing of '"' with '"'.
getProducts(User? user, AbstractQueryConfiguration configuration, {QueryType? queryType}) Future<SearchResult>
Returns products searched according to a configuration.
getProductString(ProductQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<String>
Returns the response body of "get product" API for the given barcode.
getProductUri(String barcode, {OpenFoodFactsLanguage? language, OpenFoodFactsCountry? country, QueryType? queryType, required bool replaceSubdomain}) Uri
Returns the URI to the product page on a website
getProductV3(ProductQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<ProductResultV3>
Returns the product for the given barcode. The ProductResult does not contain a product, if the product is not available. ingredients, images and product name will be prepared for the given language.
getRandomInsight(User user, {InsightType? type, String? country, String? valueTag, String? serverDomain, QueryType? queryType}) Future<InsightsResult>
getRandomRobotoffQuestion(String lang, User user, {int? count, List<InsightType>? types, QueryType? queryType}) Future<RobotoffQuestionResult>
getRobotoffQuestionsForProduct(String barcode, String lang, {User? user, int? count, QueryType? queryType}) Future<RobotoffQuestionResult>
getTaxonomy<T extends JsonObject, F extends Enum>(TaxonomyQueryConfiguration<T, F> configuration, {User? user, QueryType? queryType}) Future<Map<String, T>?>
getTaxonomyAdditives(TaxonomyAdditiveQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyAdditive>?>
getTaxonomyAllergens(TaxonomyAllergenQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyAllergen>?>
getTaxonomyCategories(TaxonomyCategoryQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyCategory>?>
getTaxonomyCountries(TaxonomyCountryQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyCountry>?>
getTaxonomyIngredients(TaxonomyIngredientQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyIngredient>?>
getTaxonomyLabels(TaxonomyLabelQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyLabel>?>
getTaxonomyLanguages(TaxonomyLanguageQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyLanguage>?>
getTaxonomyNova(TaxonomyNovaQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyNova>?>
getTaxonomyOrigins(TaxonomyOriginQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyOrigin>?>
getTaxonomyPackagingMaterials(TaxonomyPackagingMaterialQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyPackagingMaterial>?>
getTaxonomyPackagingRecycling(TaxonomyPackagingRecyclingQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyPackagingRecycling>?>
getTaxonomyPackagings(TaxonomyPackagingQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyPackaging>?>
getTaxonomyPackagingShapes(TaxonomyPackagingShapeQueryConfiguration configuration, {User? user, QueryType? queryType}) Future<Map<String, TaxonomyPackagingShape>?>
getTaxonomyTranslationUri(TagType taxonomyTagType, {required OpenFoodFactsLanguage language, QueryType? queryType, bool replaceSubdomain = true}) Uri
Returns the URI to the translation page for a taxonomy.
login(User user, {QueryType? queryType}) Future<bool>
Uses the auth.pl API to see if login was successful Returns a bool if the login data of the provided user is correct
login2(User user, {QueryType? queryType}) Future<LoginStatus?>
Logs in and returns data about the user if relevant.
postInsightAnnotation(String? insightId, InsightAnnotation annotation, {User? user, String? deviceId, bool update = true, QueryType? queryType}) Future<Status>
register({required User user, required String name, required String email, String? orgName, bool newsletter = true, QueryType? queryType}) Future<SignUpStatus>
Creates a new user Returns Status.status 201 = complete; 400 = wrong inputs + Status.error; 500 = server error;
resetPassword(String emailOrUserID, {QueryType? queryType}) Future<Status>
Uses reset_password.pl to send a password reset Email needs only Returns Status.status 200 = complete; 400 = wrong inputs or other error + Status.error; 500 = server error;
saveProduct(User user, Product product, {QueryType? queryType, OpenFoodFactsCountry? country, OpenFoodFactsLanguage? language}) Future<Status>
Add the given product to the database. Returns a Status object as result.
searchProducts(User? user, AbstractQueryConfiguration configuration, {QueryType? queryType}) 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, QueryType? queryType}) 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, QueryType? queryType}) Future<String?>
Crops a product image from an already uploaded image.
temporarySaveProductV3(User user, String barcode, {List<ProductPackaging>? packagings, QueryType? queryType, 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, QueryType? queryType}) Future<void>
Unselect a product image.

Constants

USER_NAME_MAX_LENGTH → const int
A username may not exceed 20 characters