retrieveDateFormatter function

Future<DateFormat> retrieveDateFormatter({
  1. bool use24HourFormat = false,
  2. String languageCode = 'en',
  3. bool showTime = true,
  4. String? countryCode,
})

Retrieves a DateFormat object based on locale and preferences.

Initializes the locale if needed before creating the date formatter.

Implementation

Future<DateFormat> retrieveDateFormatter({
  bool use24HourFormat = false,
  String languageCode = 'en',
  bool showTime = true,
  String? countryCode,
}) async {
  final locale = _buildLocale(languageCode, countryCode);
  await _initializeLocaleIfNeeded(locale);

  return createDateFormatter(locale, showTime, use24HourFormat);
}