TaxonomyQueryConfiguration<T extends JsonObject, F extends Enum> class abstract

Abstract query configuration for taxonomies.

The type parameter "T" is the JsonObject that represents the Taxonomy (i.e. TaxonomyCategory) and the type parameter "F" is the type enum that goes with that taxonomy (i.e. CategoryType).

See also OpenFoodAPIClient.getTaxonomy, which takes this kind of query.

Individual Taxonomies should implement a concrete subclass of this class to allow creating of the result data from json (See TaxonomyCategoryQueryConfiguration for an example).

Implementers

Constructors

TaxonomyQueryConfiguration(TagType tagType, List<String> tags, {List<OpenFoodFactsLanguage>? languages, OpenFoodFactsCountry? country, bool includeChildren = false, List<F> fields = const [], List<Parameter> additionalParameters = const []})
Allows subclasses to create a TaxonomyQueryConfiguration from the supplied parameters.
TaxonomyQueryConfiguration.roots(TagType tagType, {List<OpenFoodFactsLanguage>? languages, OpenFoodFactsCountry? country, bool includeChildren = false, List<F> fields = const [], List<Parameter> additionalParameters = const []})

Properties

additionalParameters List<Parameter>
Additional parameters to add the to query.
final
country OpenFoodFactsCountry?
The country for this query, if any.
final
fields List<F>
The desired taxonomy fields to retrieve. If empty, retrieve all fields.
final
hashCode int
The hash code for this object.
no setterinherited
ignoredFields Set<F>
Returns the set of fields to ignore if specified in the fields parameter.
no setter
includeChildren bool
If true, include the children of the requested tag in the results.
final
languages List<OpenFoodFactsLanguage>
The languages field should be used to set the desired taxonomy language(s) when a taxonomy is requested with fields in one or more languages. The taxonomy's text fields should be filled with the requested languages in a prioritized manner based on the order supplied.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tags List<String>
The tags to request.
final
tagType TagType
The type of tags that this query should request a taxonomy for.
final

Methods

convertFieldsToStrings(Iterable<F> fields) Iterable<String>
Converts the given list of fields to their corresponding query string values.
convertResults(dynamic jsonData) Map<String, T>
Creates a map of the correct taxonomy type from the raw JSON data.
getParametersMap() Map<String, String>
Returns the corresponding API URI parameter map, including additionalParameters.
getPostUri([QueryType? queryType]) Uri
getUri([QueryType? queryType]) Uri
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