LocalazeDelegate class
A LocalizationsDelegate for Localaze that handles initialization and locale changes. This delegate is responsible for loading and initializing the Localaze instance when the app starts or when the locale changes.
Usage:
MaterialApp(
localizationsDelegates: [
LocalazeDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
Locale('en'),
Locale('es'),
// Add your supported locales
],
// ...
)
- Inheritance
-
- Object
- LocalizationsDelegate<
Localaze> - LocalazeDelegate
Constructors
- LocalazeDelegate.new({Locale? overrideLocale, bool useDeviceLocale = true})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- overrideLocale → Locale?
-
Creates a delegate instance.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- translationsVersion → int
-
Keep track of the translations version to detect changes
final
- type → Type
-
The type of the object returned by the load method, T by default.
no setterinherited
- useDeviceLocale → bool
-
Whether to use the device locale as the initial locale.
If false, will use the default locale from TranslationsConfig.
final
Methods
-
isSupported(
Locale locale) → bool -
Whether resources for the given locale can be loaded by this delegate.
override
-
load(
Locale locale) → Future< Localaze> -
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 LocalazeDelegate 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