OpenFoodAPIConfiguration class

Allows to configure the behavior of the package, for example to set a global UserAgent or to point the url to a self hosted instance of the backend.

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 Properties

globalCountry OpenFoodFactsCountry?
A global way to specify the country code for queries, can be overwritten for each individual request by specifying the country code in the individual request configurations
getter/setter pair
globalLanguages List<OpenFoodFactsLanguage>?
A global way to specify the languages for queries, can be overwritten for each individual request by specifying the languages in the individual request configurations
getter/setter pair
globalQueryType QueryType
Changes whether the requests sent by this package to the test or main server.
getter/setter pair
globalUser User?
Defines a global user to avoid adding it to every request
getter/setter pair
imageProdUrlBase String
Url base for images in prod: needs to match the domain of uriProdHost
getter/setter pair
imageTestUrlBase String
Url base for images in test: needs to match the domain of uriTestHost
getter/setter pair
uriProdHost String
Uri host of the main requests to the backend, modify this to direct the request to a self-hosted instance.
getter/setter pair
uriProdHostEvents String
Uri host of the Events requests to the backend, modify this to direct the request to a self-hosted instance.
getter/setter pair
uriProdHostFolksonomy String
Uri host of the Folksonomy requests to the backend, modify this to direct the request to a self-hosted instance.
getter/setter pair
uriProdHostRobotoff String
Uri host of the Robotoff requests to the backend, modify this to direct the request to a self-hosted instance.
getter/setter pair
uriScheme String
change the uriScheme of the requests
getter/setter pair
uriTestHost String
Uri host of the test requests to the backend
getter/setter pair
uriTestHostEvents String
Uri host of the test requests to Events
getter/setter pair
uriTestHostFolksonomy String
Uri host of the test requests to Folksonomy
getter/setter pair
uriTestHostRobotoff String
Uri host of the test requests to Robotoff
getter/setter pair
userAgent UserAgent?
Defines a global userAgent to tell the backend the source of the request.
getter/setter pair
uuid String?
Defines a global uuid to tell the backend the source of the request.
getter/setter pair

Static Methods

computeCountryCode(OpenFoodFactsCountry? country, String? cc) String?
Returns the most relevant country code
getQueryType(QueryType? queryType) QueryType
Returns the QueryType to use, using a default value
getUser(User? user) User?
Returns the User to use, using a default value