fromOffTag static method

OpenFoodFactsCountry? fromOffTag(
  1. String? offTag
)
override

Returns the OpenFoodFactsCountry that matches the offTag.

Case-insensitive. Special case: "uk" and "gb" both mean United Kingdom.

Implementation

static OpenFoodFactsCountry? fromOffTag(String? offTag) {
  offTag = offTag?.toLowerCase();
  // special case as we use 'uk' in off-dart
  if (offTag == 'gb') {
    return OpenFoodFactsCountry.UNITED_KINGDOM;
  }
  return OffTagged.fromOffTag(offTag, OpenFoodFactsCountry.values)
      as OpenFoodFactsCountry?;
}