toLocale method
Produces a Locale instance for the parser's current state.
Returns null if the Locale would be syntactically invalid.
Implementation
LocaleImplementation? toLocale() {
if (problems.isNotEmpty) return null;
LocaleExtensions? extensions;
if (_uExtensions != null ||
_tExtensions != null ||
_otherExtensions != null ||
_xExtensions != null) {
extensions = LocaleExtensions(
_uExtensions, _tExtensions, _otherExtensions, _xExtensions);
}
return LocaleImplementation.unsafe(
_languageCode,
scriptCode: _scriptCode,
countryCode: _countryCode,
variants: _variants,
extensions: extensions,
);
}