Locale.fromSubtags constructor

const Locale.fromSubtags(
  1. {String languageCode: 'und',
  2. String scriptCode,
  3. String countryCode}

Creates a new Locale object.

The keyword arguments specify the subtags of the Locale.

The subtag values are case sensitive and must be valid subtags according to CLDR supplemental data: language, script and region for each of languageCode, scriptCode and countryCode respectively.

The countryCode subtag is optional. When there is no country subtag, the parameter should be omitted or passed null instead of an empty-string.

Validity is not checked by default, but some methods may throw away invalid data.


const Locale.fromSubtags({
  String languageCode = 'und',
  String countryCode,
}) : assert(languageCode != null),
     assert(languageCode != ''),
     _languageCode = languageCode,
     assert(scriptCode != ''),
     assert(countryCode != ''),
     _countryCode = countryCode;