---
title: "Why does Flutter throw a LocaleDataException saying the locale data has not been initialized?"
description: "Because `DateFormat` was used with a locale other than `en_US` before the date symbols were loaded. Call `await initializeDateFormatting()` from `package:intl/date_symbol_data_local.dart` before the first format call, for example in `main` before `runApp`."
category: flutter
date: 2026-10-09
canonical: https://localizely.com/i18n-questions/flutter/why-does-flutter-throw-localedataexception-locale-data-has-not-been-initialized/
---

# Why does Flutter throw a LocaleDataException saying the locale data has not been initialized?

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:

```dart
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`](https://pub.dev/documentation/intl/latest/date_symbol_data_local/initializeDateFormatting.html) 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`](https://pub.dev/documentation/intl/latest/intl/Intl/defaultLocale.html), 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?](/i18n-questions/flutter/how-to-use-localized-date-in-flutter/) for the formatting itself.

Source: https://localizely.com/i18n-questions/flutter/why-does-flutter-throw-localedataexception-locale-data-has-not-been-initialized/
