BuildContextEasyLocalizationExtension extension

BuildContext extension method for access to locale, supportedLocales, fallbackLocale, delegates and deleteSaveLocale()

Example :

context.locale = Locale('en', 'US');


print(context.supportedLocales); // output: [en_US, ar_DZ, de_DE, ru_RU]
print(context.fallbackLocale);   // output: en_US


deviceLocale Locale
Getting device locale from platform
no setter
fallbackLocale Locale?
Get fallback locale
no setter
locale Locale
Get current locale
getter/setter pair
localizationDelegates List<LocalizationsDelegate>
The delegates for this app's Localizations widget.
no setter
supportedLocales List<Locale>
Get List of supported locales.
no setter


deleteSaveLocale() Future<void>
Clears a saved locale from device storage
plural(String key, num number, {List<String>? args, Map<String, String>? namedArgs, String? name, NumberFormat? format}) String
resetLocale() Future<void>
Reset locale to platform locale
setLocale(Locale val) Future<void>
Change app locale
tr(String key, {List<String>? args, Map<String, String>? namedArgs, String? gender}) String
An extension method for translating your language keys. Subscribes the widget on current Localization that provided from context. Throws exception if Localization was not found.