countryCode property

String? get countryCode

The region subtag for the locale.

This may be null, indicating that there is no specified region subtag.

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

Region subtags that are deprecated in the registry and have a preferred code are changed to their preferred code. For example, const Locale('de', 'DE') and const Locale('de', 'DD') are equal, and both have the countryCode DE, because DD is a deprecated language subtag that was replaced by the subtag DE.

See also:

Implementation

String? get countryCode => _deprecatedRegionSubtagMap[_countryCode] ?? _countryCode;