setCountry static method
- UserPreferences userPreferences,
- String isoCode
Sets the global country for API queries: explicit choice by the user.
Returns true if the isoCode was correctly detected.
Implementation
static Future<bool> setCountry(
UserPreferences userPreferences,
String isoCode,
) async {
final OpenFoodFactsCountry? country = OpenFoodFactsCountry.fromOffTag(
isoCode,
);
if (country == null) {
return false;
}
await _setCountry(userPreferences, country);
return true;
}