localeFromString function

Locale? localeFromString(
  1. String? languageCode
)

Converts a language code string to a corresponding Locale.

Returns null if the provided languageCode is null or empty.

languageCode The language code to convert to a Locale.

Implementation

Locale? localeFromString(final String? languageCode) {
  if (languageCode == null || languageCode.isEmpty) return null;
  return UiLanguage.byCode(languageCode)?.locale;
}