CustomLanguage class

class LanguageModel extends CustomLanguage {
 @override
 Map<String, LanguageInstance> get addedLanguages => {
   'am': LangAmharic(),
   'en': LangEnglish()
 };
 
 @override
 List<LangModel> get globalAccessableValues => [
   LangModel('name_e', 'name_english'),
   LangModel('name_a', 'name_amharic')
 ];
 
 LanguageModel({
   @required String langCode
 }) : super(langCode: langCode);
}
Implementers

Constructors

CustomLanguage({@required String langCode, Map<String, LanguageInstance> addedLanguages})

Properties

addedLanguages Map<String, LanguageInstance>
this is the variable that holds the added languages
read / write
globalAccessableValues List<LangModel>
this variable holds values that are shared between all the language models this helps us not to decleare multiple same values from multiple class
read / write
hashCode int
The hash code for this object.
read-onlyinherited
langCode String
the language code like en of the currently selected language
read / write
languageInstance LanguageInstance
holds info about the current selected language
read / write
languagesIndex Map<String, int>
currently available languages index
read / write
langValues List<LangModel>
language representation of the current language
read / write
replaceString String
replaceString is a String that will be used when we want to append additional data to the current data for example if we have a langValue with code price and value Price:
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
selectedLangId int
the language id given to the selected language instance
read / write

Methods

get(String langKey, {String alt = '', List append = const []}) String
this function returns the associated value of the langKey that means the first parameter of LangModel and if there is any value that the language model accepts it appends respectively for example if we assume that itemsAdded holds the below value for English You have added $replaceString item(s) for Amharic $replaceString እቃ(ዎችን) አክለዋል
getAvailableLanguages() List<DropdownLangModel>
returns all the available languages as a dropdown model
join(String joiner, {List values}) String
this function joins an array with a string
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
parse(dynamic value, {List<String> keys = const [], String append = ""}) List<String>
this function parses values from a JSON Object with multible language dependences for example if we have a values the come from an Api call or something like this
set(List value, {int index = -1}) String
this function gets a value from the an array and returns a String based on the selected language if the length of the array passed is less than the available languages it return the first value of the array assume if we have a product with two different name like below
setCurrentLanguage() → dynamic
this function set the current language values from its respective class or refresh if there is any changes made and adds the globalAccessableValues to the model
toString() String
A string representation of this object.
inherited
withCode({String langCode}) CustomLanguage
this function will be used to call other language models directly from the currently selected language model for example if the current selected language is English and i wanted to access others language values without changing the currently selected language like Amharic i can do it like this with language code am

Operators

operator ==(Object other) bool
The equality operator.
inherited