Language class

A class representing a language, including its code, optional country code, numerical digits, and names in English and native scripts.

Constructors

Language.fromCode(String code, [String? countryCode])
Factory constructor to create a Language from a code. Handles Chinese (zh) variants for "CN" and "TW".
factory

Properties

code → String
ISO language code, possibly including a country code suffix (e.g., "zh_CN").
final
countryCode → String?
Optional ISO country code associated with the language.
final
digits → String?
The numerical digits used for the language.
final
hashCode → int
The hash code for this object.
no setteroverride
locale → String
Returns the full locale string combining language and country codes.
no setter
name → String?
Language name in English.
final
nameInNative → String?
Language name in its native script.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
source → Map<String, dynamic>
Returns a map representation of the language object.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
Search the language by code, English name, native name, or country code.
toString() → String
A string representation of this object.
override

Operators

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

Static Methods

tryParse(String locale) → Language?
Attempts to parse a locale string (e.g., "en_US") into a Language.