FormModelLocalizations class
A singleton class that manages localizations for form error messages.
This class provides functionality to:
- Set and manage current and fallback locales
- Translate error keys to localized messages
- Manage custom translations
- Handle predefined and custom error keys
Constructors
- FormModelLocalizations()
-
Factory constructor that returns the singleton instance.
factory
Properties
- currentLocale → Locale
-
Gets the current locale.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
supportedLocales
→ Set<
String> -
Gets the set of all supported locales.
no setter
Methods
-
clearCustomErrorTranslations(
String locale) → void - Clears all custom translations for a specific locale.
-
hasCustomTranslationsForLocale(
String locale) → bool - Checks if there are any custom translations for a given locale.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeCustomErrorTranslation(
String locale, FormErrorKey key) → void - Removes a custom translation for a specific error key and locale.
-
setCurrentLocale(
Locale locale) → void - Sets the current locale for translations.
-
setCustomErrorTranslations(
String locale, FormErrorKey key, String message) → void - Sets a custom translation for a specific error key and locale.
-
setFallbackLocale(
Locale? locale) → void - Sets the fallback locale for translations.
-
toString(
) → String -
A string representation of this object.
inherited
-
translateErrorKey(
FormErrorKey errorKey) → String? - Translates a given error key to a localized message.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited