languageCode property Null safety

String languageCode

The primary language subtag for the locale.

This must not be null. It may be 'und', representing 'undefined'.

This is expected to be string registered in the IANA Language Subtag Registry with the type "language". The string specified must match the case of the string in the registry.

Language subtags that are deprecated in the registry and have a preferred code are changed to their preferred code. For example, const Locale('he') and const Locale('iw') are equal, and both have the languageCode he, because iw is a deprecated language subtag that was replaced by the subtag he.

This must be a valid Unicode Language subtag as listed in Unicode CLDR supplemental data.

See also:

Implementation

String get languageCode => _deprecatedLanguageSubtagMap[_languageCode] ?? _languageCode;