getProductUri static method

Uri getProductUri(
  1. String barcode, {
  2. OpenFoodFactsLanguage? language,
  3. OpenFoodFactsCountry? country,
  4. UriProductHelper uriHelper = uriHelperFoodProd,
  5. 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,
  );
}