AppLocale enum

Supported locales.

Usage:

  • LocaleSettings.setLocale(AppLocale.ar) // set locale
  • Locale locale = AppLocale.ar.flutterLocale // get flutter locale from enum
  • if (LocaleSettings.currentLocale == AppLocale.ar) // locale check
Inheritance
Mixed-in types
Available extensions

Values

ar → const AppLocale
const AppLocale(languageCode: 'ar')
en → const AppLocale
const AppLocale(languageCode: 'en')

Properties

countryCode String?
final
hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
languageCode String
final
languageTag String
Concatenates language, script and country code with dashes. Resembles Locale.toLanguageTag of dart:ui.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scriptCode String?
final
translations Translations
Gets current instance managed by LocaleSettings.
no setter
underscoreTag String
For whatever reason, the intl package uses underscores instead of dashes that contradicts https://www.unicode.org/reports/tr35/ that is used by the Locale class in dart:ui.
no setterinherited

Methods

build({Map<String, Node>? overrides, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) Future<Translations>
Gets a new translation instance. LocaleSettings has no effect here. Suitable for dependency injection and unit tests.
override
buildSync({Map<String, Node>? overrides, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) Translations
Similar to build but synchronous. This might throw an error on Web if the library is not loaded yet (Deferred Loading).
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sameLocale(BaseAppLocale<BaseAppLocale, BaseTranslations> other) bool
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<AppLocale>
A constant List of the values in this enum, in order of their declaration.