trySetLocale static method
void
trySetLocale(
- String langCode, {
- IfLocaleNotFound ifLocaleNotFound = IfLocaleNotFound.doNothing,
Try to set Locale by string in LocaleSwitcher.supportedLocaleNames.
Just wrapper around: tryFindLocale and LocaleSwitcher.current = newValue;
If not found: do ifLocaleNotFound
Implementation
static void trySetLocale(String langCode,
{IfLocaleNotFound ifLocaleNotFound = IfLocaleNotFound.doNothing}) {
var loc = tryFindLocale(langCode, ifLocaleNotFound: ifLocaleNotFound);
if (loc != null) {
LocaleSwitcher.current = loc;
}
}