LocaleStringTable class
An immutable flat mapping from string key → localized string for one Locale.
Multiple tables may be merged together (LocaleStringTable.merge), e.g. one file per feature area:
final table = LocaleStringTable.merge([uiTable, gameplayTable]);
Constructors
-
LocaleStringTable({required Locale locale, required Map<
String, String> strings}) -
The table for
localeholdingstrings, keyed by full (dotted) key. The map is kept, not copied: don't change it afterwards.const -
LocaleStringTable.fromMap(Locale locale, Map<
String, Object?> map) -
Creates a table from a plain Dart Map.
factory
-
LocaleStringTable.merge(List<
LocaleStringTable> tables) -
Merges
tablesinto a single table (later entries win on conflict).factory
Properties
-
entries
→ Map<
String, String> -
Read-only view of all entries.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- locale → Locale
-
The locale this table belongs to.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
Number of keys in this table.
no setter
Methods
-
get(
String key) → String? -
Returns the string for
key, ornullif absent. -
getOrFallback(
String key, String fallback) → String -
Returns the string for
key, orfallbackif absent. -
has(
String key) → bool -
trueifkeyexists in this table. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
loadAsset(
Locale locale, String assetPath, {AssetBundle? bundle}) → Future< LocaleStringTable> -
Loads and parses a JSON asset from
assetPath.