TranslationsDelegate<T> class

LocalizationsDelegate that allow you to load ARB files on the fly

Inheritance

Constructors

TranslationsDelegate({required Locale defaultLocale, String currentFlavor = IntlDelegate.defaultFlavorName, Locale? overrideCurrentLocale, void onError(dynamic err, dynamic stack)?, String defaultFlavor = IntlDelegate.defaultFlavorName, required FlutterIntlDataLoader dataLoader, FlutterIntlUpdateDataLoader? updateDataLoader, required T translationsBuilder(), VoidCallback? onTranslationsUpdated, List<Locale> supportedLocales = const []})
Construct an object that will manage the localized strings of your app You're in change of instantiate your localization class file with translationsBuilder
TranslationsDelegate.withRemoteManager({required Locale defaultLocale, String currentFlavor = IntlDelegate.defaultFlavorName, Locale? overrideCurrentLocale, String defaultFlavor = IntlDelegate.defaultFlavorName, required FlutterIntlDataLoader dataLoader, required RemoteTranslationsManager localizationManager, required T translationsBuilder(), void onError(dynamic err, dynamic stack)?, VoidCallback? onTranslationsUpdated, List<Locale> supportedLocales = const []})

Properties

currentFlavor String
Current flavor of your app
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
onTranslationsUpdated VoidCallback?
Callback that will be called when translations are updated, it means you need to rebuild your app in order to see those
final
overrideCurrentLocale Locale?
Locale to use instead of the one given by the system
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportedLocales List<Locale>
Supported locales of your app
final
translationsBuilder → T Function()
Callback to create your Localization file, it will be called when needed by Flutter
final
type Type
The type of the object returned by the load method, T by default.
no setterinherited

Methods

get(String id, {String? locale, List<Object>? args, String fallback = ''}) String?
isSupported(Locale locale) bool
Whether resources for the given locale can be loaded by this delegate.
override
load(Locale locale) Future<T>
Start loading the resources for locale. The returned future completes when the resources have finished loading.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldReload(covariant TranslationsDelegate<T> old) bool
Returns true if the resources for this delegate should be loaded again by calling the load method.
override
toString() String
A string representation of this object.
inherited

Operators

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