locale static method
Implementation
static Future<Locale> locale([String? locale]) async {
_initializeLocale();
if (locale != null) {
if (isLocalAvailable(locale)) {
throw JiffyException(
'The locale "$locale" does not exist in Jiffy, run Jiffy.getAllAvailableLocales() for more locales')
.cause;
}
await initializeDateFormatting();
Intl.defaultLocale = locale;
_defaultLocale = getLocale(locale);
_defaultLocale.code = locale.toLowerCase();
}
return Future.value(_defaultLocale);
}