IntlDelegate class
Delegate to manage locales and flavors
Constructors
- IntlDelegate({required IntlDataLoader dataLoader, required String defaultLocale, IntlUpdateDataLoader? updateDataLoader, String defaultFlavor = defaultFlavorName, bool cacheLocale = true, void onError(dynamic err, dynamic stack)?})
- Construct an object that deal with locales and flavors in order to give you the correct translations depending on the loaded locales, the current locale and flavor.
- IntlDelegate.withRemoteManager({required IntlDataLoader dataLoader, required String defaultLocale, required RemoteTranslationsManager localizationManager, String defaultFlavor = defaultFlavorName, void onError(dynamic err, dynamic stack)?})
- Construct a delegate to manage locales and flavors with a remote manager That will allow to use external manager to manage OTA cache and download of ARB files. See jimtl_localazy as example
Properties
- dataLoader → IntlDataLoader
-
final
- defaultFlavor → String
-
final
- defaultLocale → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- onError → (void Function(dynamic err, dynamic stack)?)
-
Callback to create your Localization file, it will be called when needed by Flutter
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- updateDataLoader → IntlUpdateDataLoader?
-
final
Methods
-
askForUpdate(
) → Future< bool> - this method will trigger updateDataLoader for the needed locales and flavors You can use this method to trigger remote download of ARBs files for example Returns true if translations have been updated, false otherwise
-
get(
String id, {String? locale, List< Object> ? args, String fallback = ''}) → String? - Get translated sentence by id/name Returns translated sentence or null if not found
-
load(
String currentLocale, {String currentFlavor = defaultFlavorName}) → Future< void> -
Init Intl with the
currentLocale
andcurrentFlavor
, it will call dataLoader to load the locale data needed to do the translations -
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
Constants
- defaultFlavorName → const String