IntlStrings constructor
IntlStrings(
- List<
IntlString> values, { - Locale? defaultLocale,
- Locale currentLocaleFunction()?,
- Locale? fallbackLocale,
Constructor
Notes:
- If
localeis not set or is null,currentLocaleFunctionwill be used. - If
currentLocaleFunctionis not null, it will be called to get the current locale. - If
Localeis set, it will be used andcurrentLocaleFunctionwill be ignored.
Implementation
IntlStrings(
List<IntlString> values, {
Locale? defaultLocale,
Locale Function()? currentLocaleFunction,
Locale? fallbackLocale,
}) : _strings = Map.fromEntries(values.map((s) => MapEntry(s.locale, s))),
defaultLocale =
defaultLocale ??
(currentLocaleFunction != null
? currentLocaleFunction()
: getCurrentLocale()),
fallbackLocale =
fallbackLocale ?? Locale.fromSubtags(languageCode: 'en');