LocalizedType<T> class
Null safety
Provides a localized string with an easy to use interface. Takes a default locale and stores a map of localized versions of the same string, then provides a getter that retrieves the nearest match. Nearest match means:
- provide requested localized version if it exists
- provide version in default locale if it exists
- Implemented types
-
- Built<
LocalizedType< T> , LocalizedTypeBuilder<T> >
- Built<
Constructors
-
LocalizedType([void updates(LocalizedTypeBuilder<
T> )]) -
factory
Properties
- defaultLocale → String
-
read-only
- defaultValue → T
-
read-only
- hashCode → int
-
The hash code for this object.
read-onlyinherited
-
localizedVersions
→ BuiltMap<
String, T> -
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
rebuild(
dynamic updates(LocalizedTypeBuilder< T> )) → LocalizedType<T> -
Rebuilds the instance.
inherited
-
toBuilder(
) → LocalizedTypeBuilder< T> -
Converts the instance to a builder
B.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
value(
{String? locale}) → T - Returns the default value if no locale is provided. If a locale is provided, it returns the corresponding localized value or the default value if the requested locale is not contained in the localized string.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited