getProductUri static method
Uri
getProductUri(
- String barcode, {
- OpenFoodFactsLanguage? language,
- OpenFoodFactsCountry? country,
- UriProductHelper uriHelper = uriHelperFoodProd,
- required bool replaceSubdomain,
Returns the URI to the product page on a website
If the target website supports different domains for country + language,
replaceSubdomain
should be set to true.
Implementation
static Uri getProductUri(
final String barcode, {
final OpenFoodFactsLanguage? language,
final OpenFoodFactsCountry? country,
final UriProductHelper uriHelper = uriHelperFoodProd,
required final bool replaceSubdomain,
}) {
final Uri uri = uriHelper.getUri(
path: 'product/$barcode',
addUserAgentParameters: false,
);
if (!replaceSubdomain) {
return uri;
}
return UriHelper.replaceSubdomain(
uri,
language: language,
country: country,
);
}