Locale.fromSubtags constructor

const Locale.fromSubtags({String languageCode: 'und' String scriptCode 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.

Implementation

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