PlayxLocalization class abstract

PlayxLocalization : Used to update current app locale with id, index, device locale and more. And holds reference to the current app locale. With other utilities to be used. Must be initialized by calling boot before calling any method.

Constructors

PlayxLocalization()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

currentLocaleToString({String separator = '_'}) String
Convert current locale to String with custom separator representing language code and country code.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

currentIndex int
Returns current locale index.
no setter
currentLocale Locale
Returns the current Locale that is used in the app.
no setter
currentXLocale XLocale
Returns current XLocale that is used in the app.
no setter
deviceLocale Locale?
Returns the locale of device.
no setter
fallbackLocale XLocale?
Returns the current fallback Locale that is used in the app. If useFallbackTranslations in config is false, it will return null. Else it will return the fallback locale based on config. If no fallback locale is found, it will use english locale if found. If no english locale is found, it will return the first locale in the supported locales list. If no supported locales are found, it will return null.
no setter
localizationDelegates List<LocalizationsDelegate>
no setter
supportedLocales List<Locale>
Returns the current supported locales.
no setter
supportedXLocales List<XLocale>
returns the current supported xLocales.
no setter

Static Methods

boot({required PlayxLocaleConfig config}) Future<void>
Setup the current app locales with your configuration. And loads app supported translations. Must be called before calling any other method to initialize dependencies.
deleteSavedLocale() Future<void>
delete saved locale from device storage.
isCurrentLocaleArabic() bool
Check if current locale is arabic.
isCurrentLocaleEnglish() bool
Check if current locale is english.
isCurrentLocaleRtl() bool
Check if current locale is rtl.
nextLocale({bool forceAppUpdate = false}) Future<void>
Switch the locale to the next in the supported locales list if there is no next locale, it will switch to the first one
updateById(String id, {bool forceAppUpdate = false}) Future<bool>
update the theme to by id
updateByIndex(int index, {bool forceAppUpdate = false}) Future<bool>
Update the locale by index
updateByLanguageCode({required String languageCode, String? countryCode, bool forceAppUpdate = false}) Future<bool>
update the locale by language code and country code if available.
updateTo(XLocale locale, {bool forceAppUpdate = false}) Future<bool>
Update the locale to be one of the supported locales.
updateToDeviceLocale({bool forceAppUpdate = false}) Future<bool>
Updates the locale to current device locale.