MultiString class

An object that contains string translations for multiple languages. Language keys use two-varter codes like: 'en', 'sp', 'de', 'ru', 'fr', 'pr'. When translation for specified language does not exists it defaults to English ('en'). When English does not exists it falls back to the first defined language.

Example

var values = MultiString.fromTuples([
    'en', 'Hello World!',
    'ru', 'Привет мир!'
]);

var value1 = values.get('ru'); // Result: 'Привет мир!'
var value2 = values.get('pt'); // Result: 'Hello World!'

Constructors

MultiString([dynamic map ])
Creates a new MultiString object and initializes it with values. [...]
MultiString.fromJson(Map<String, dynamic> json)
Creates a new MultiString object and initializes it from json values. [...]
factory

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

append(dynamic map) → void
Appends a map with language-translation pairs. [...]
clear() → void
Clears all translations from this MultiString object.
fromJson(Map<String, dynamic> json) → void
Initialize this object from JSON Map object
get(String language) → String
Gets a string translation by specified language. When language is not found it defaults to English ('en'). When English is not found it takes the first value. [...]
getLanguages() → List<String>
Gets all languages stored in this MultiString object, [...]
innerValue() → dynamic
Returned inner values in Map object
length() → int
Returns the number of translations stored in this MultiString object. [...]
put(String language, dynamic value) → void
Puts a new translation for the specified language. [...]
remove(String language) → void
Removes translation for the specified language. [...]
toJson() → Map<String, dynamic>
Returned JSON Map object from values of this object
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited

Static Methods

fromTuples(List tuples) MultiString
Creates a new MultiString object from language-translation pairs (tuples). [...]
fromTuplesArray(List tuples) MultiString
Creates a new MultiString object from language-translation pairs (tuples) specified as array. [...]
fromValue(dynamic value) MultiString
Creates a new MultiString object from a value that contains language-translation pairs. [...]