getEcoscoreHtmlDescription static method

  1. @Deprecated('Use getProduct with ecoscore fields instead')
Future<String?> getEcoscoreHtmlDescription(
  1. String barcode,
  2. OpenFoodFactsLanguage language, {
  3. QueryType? queryType,
})

Returns the Ecoscore description in HTML

Implementation

// TODO: deprecated from 2022-01-22; remove when old enough
@Deprecated('Use getProduct with ecoscore fields instead')
static Future<String?> getEcoscoreHtmlDescription(
  final String barcode,
  final OpenFoodFactsLanguage language, {
  final QueryType? queryType,
}) async {
  try {
    final ProductResult productResult = await getProduct(
      ProductQueryConfiguration(
        barcode,
        language: language,
        country: null,
        fields: [ProductField.ENVIRONMENT_INFOCARD],
        version: ProductQueryVersion.v0,
      ),
      user: null,
      queryType: queryType,
    );
    return productResult.product?.environmentInfoCard;
  } catch (e) {
    return null;
  }
}