searchProducts static method

Future<SearchResult> searchProducts(
  1. User? user,
  2. AbstractQueryConfiguration configuration, {
  3. QueryType? queryType,
})

Search the OpenFoodFacts product database with the given parameters. Returns the list of products as SearchResult. Query the language specific host from OpenFoodFacts.

Implementation

static Future<SearchResult> searchProducts(
  final User? user,
  final AbstractQueryConfiguration configuration, {
  final QueryType? queryType,
}) async {
  final Response response = await configuration.getResponse(user, queryType);
  final String jsonStr = _replaceQuotes(response.body);
  final SearchResult result = SearchResult.fromJson(json.decode(jsonStr));
  _removeImages(result, configuration);
  return result;
}