Language class

Language data according to ISO-639.

Get Locale from Language with:

Locale locale = this.toLocale();

Get the list of all languages with:

List<Language> languages = Language.values();

Constructors

Language({required String code, required String countryCode, required String name})
Constructor for a single language

Properties

code → String
ISO-639 Alpha-2 code. 2 char lowercase
final
countryCode → String
ISO-3166 country code used to display flag
final
hashCode → int
The hash code for this object.
no setterinherited
name → String
ISO-639 Name in locale code
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

getTranslation([Locale? locale]) → String
Gets name translated to locale.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toLocale() → Locale
Returns Dart Locale with code and countryCode
toString() → String
A string representation of this object.
override

Operators

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

Static Properties

defaultLanguage → Language
final
platformCountryCode → String
Special code ("XX") for country to use Locale from platform
final
platformLanguage → Language
Special entry for LanguageChooser to choose locale from platform
final
platformLanguageCode → String
Special code ("xx") to use Locale from platform
final
platformLocale → Locale
Special locale to use locale from platform
final

Static Methods

fromLocale(Locale? locale) → Language?
Returns language from given locale if available.