Language class

Represents a language with its code, name, and optional region

Constructors

Language({required String code, required String name, String? region})
const
Language.fromCode(String raw)
Build a language from a raw header code ('en', 'en_US', 'pt-BR').
factory
Language.locale({required String code, required String name, required String? region})
Create a locale-specific language (e.g., en_US, pt_BR)

Properties

code → String
final
fullCode → String
Get the full language code including region if present
no setter
hashCode → int
The hash code for this object.
no setteroverride
hasRegion → bool
Check if this is a locale-specific language
no setter
name → String
final
region → String?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({String? code, String? name, String? region}) → Language
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.
override

Static Methods

normalizeCode(String raw) → String
Canonical form of a raw header code: 'en-US', ' EN_us ' -> 'en_us'.