Because intl only has the en_US date symbols available without setup. Creating a DateFormat for any other locale, even plain en, throws LocaleDataException: Locale data has not been initialized, call initializeDateFormatting(<locale>). until the symbols are loaded.
Load them once, before the first format call:
import 'package:flutter/material.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
Future<void> main() async {
await initializeDateFormatting();
runApp(const MyApp());
}
// Anywhere after that:
final String text = DateFormat.yMMMMd('de').format(DateTime(2026, 10, 9)); // 9. Oktober 2026
initializeDateFormatting accepts an optional locale argument, but the date_symbol_data_local implementation ignores it and loads the data for all locales, so initializeDateFormatting('de') and initializeDateFormatting() do the same thing. The call is plain Dart and does not need WidgetsFlutterBinding.ensureInitialized(); add that line only if you also do platform work before runApp.
DateFormat without a locale argument uses Intl.defaultLocale, which is en_US unless you set it. Setting Intl.defaultLocale = 'de' makes the no-argument constructors format in German, but it loads no data, so the initialization call is still required.
Why it sometimes works without the call: GlobalMaterialLocalizations.delegate from flutter_localizations loads the date symbols for every locale it ships translations for the first time it loads, which happens when the MaterialApp that lists it builds. Inside the widget tree of such an app, DateFormat.yMMMMd('de') works without initializeDateFormatting. It fails in code that runs earlier or elsewhere: in main before runApp, in a background isolate, in plain Dart tests, and for a locale that flutter_localizations does not cover. Relying on that makes the point where date formatting becomes safe hard to see, so calling initializeDateFormatting in main is the reliable choice.
Once the data is loaded, see How to use localized date in Flutter? for the formatting itself.
Published Oct 9, 2026 · Markdown version