searchProducts static method
Implementation
static Future<SearchResult> searchProducts(
User? user,
AbstractQueryConfiguration configuration, {
required UriProductHelper uriHelper,
required SearchProductsType type,
}) async {
await type.waitIfNeeded();
// It's better to do the HTTP actions outside of "compute", because
// there are init phases for HTTP (like user agent and SSL certificates)
// that would need to be somehow replicated for a new "compute thread".
// Besides, putting HTTP in "compute" wouldn't improve the performances.
final Response response = await configuration.getResponse(user, uriHelper);
TooManyRequestsException.check(response);
final SearchResult result = await compute(_decodeProducts, response.body);
_removeImages(result, configuration);
return result;
}