getAutocompletedSuggestions static method
Future<List>
getAutocompletedSuggestions(
- TagType taxonomyType, {
- String input = '',
- OpenFoodFactsLanguage language = OpenFoodFactsLanguage.ENGLISH,
- QueryType? queryType,
- int limit = 25,
Returns suggestions.
The limit
has a max value of 400 on the server side.
Implementation
static Future<List<dynamic>> getAutocompletedSuggestions(
final TagType taxonomyType, {
final String input = '',
final OpenFoodFactsLanguage language = OpenFoodFactsLanguage.ENGLISH,
final QueryType? queryType,
final int limit = 25,
}) async {
final Uri uri = UriHelper.getPostUri(
path: '/cgi/suggest.pl',
queryType: queryType,
);
final Map<String, String> queryParameters = <String, String>{
'tagtype': taxonomyType.offTag,
'term': input,
'lc': language.offTag,
'limit': limit.toString(),
};
final Response response = await HttpHelper().doPostRequest(
uri,
queryParameters,
null,
queryType: queryType,
addCredentialsToBody: false,
);
return json.decode(response.body);
}