INNER CODE UNIT · Dart
_resolveLocale
jama5262/jiffy · lib/src/jiffy.dart:287
static Locale _resolveLocale() {
final currentLocale = Intl.getCurrentLocale();
if (_cachedLocale case final cached? when cached.code == currentLocale) {
return cached; // Return the cached locale if it matches the current locale
}
// Otherwise, create a new Locale instance and cache it for future use
return _cachedLocale = Locale(
code: currentLocale,
startOfWeek: getStartOfWeek(currentLocale),
ordinals: getOrdinals(currentLocale),
relativeDateTime: getRelativeDateTime(currentLocale),
);
}
void _initializeDateTime(Object? input, String? pattern, bool isUtc) {
if (input is DateTime) {
_dateTime = input;