---
title: "Why can't Flutter import package:flutter_gen/gen_l10n/app_localizations.dart anymore?"
description: "Flutter 3.32 stopped generating the synthetic `flutter_gen` package; `flutter gen-l10n` now writes `app_localizations.dart` into your source tree, by default under `lib/l10n`. Import it from there and remove `synthetic-package` from `l10n.yaml`."
category: flutter
date: 2026-10-09
canonical: https://localizely.com/i18n-questions/flutter/why-cant-flutter-import-package-flutter-gen-gen-l10n-app-localizations-anymore/
---

# Why can't Flutter import package:flutter_gen/gen_l10n/app_localizations.dart anymore?

Because the synthetic `package:flutter_gen` no longer exists. Since Flutter 3.32 (the change landed in 3.28.0-0.0.pre) gen-l10n writes the generated classes into your project, by default next to the ARB files in `lib/l10n`, and Flutter 3.35 removed the synthetic package completely ([breaking change note](https://docs.flutter.dev/release/breaking-changes/flutter-generate-i10n-source)). Import the file from its real location:

```dart
// from lib/main.dart
import 'l10n/app_localizations.dart';

// or from any file in the project
import 'package:my_app/l10n/app_localizations.dart';
```

Where the file lands is controlled by `l10n.yaml` in the project root: `arb-dir` (default `lib/l10n`) is also the output directory unless you set `output-dir`:

```yaml
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
output-dir: lib/generated
```

Delete any `synthetic-package` line. On current Flutter, `synthetic-package: true` stops the tool with `Cannot enable "synthetic-package", this feature has been removed.` and `synthetic-package: false` only prints a warning that the key has no effect. Note also that the synthetic path was always `package:flutter_gen/gen_l10n/app_localizations.dart`; the variant `package:flutter_gen/l10n/...` never existed, which is why it failed on older versions too.

`Undefined name 'AppLocalizations'` is the same family of problem: the class is not visible from your file, either because the import points to the wrong path or because the file has not been generated yet. Generation requires `generate: true` under `flutter:` in `pubspec.yaml` (without it `flutter gen-l10n` exits with "Attempted to generate localizations code without having the flutter: generate flag turned on") and runs on `flutter pub get`, `flutter run` or an explicit `flutter gen-l10n` ([internationalization guide](https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization)). Check that `arb-dir` points at the folder that actually contains `template-arb-file`, then look for `app_localizations.dart` in the output directory.

If the files are still missing after that, see [Why doesn't Flutter generate localization files?](/i18n-questions/flutter/why-does-not-flutter-generate-localization-files/).

Source: https://localizely.com/i18n-questions/flutter/why-cant-flutter-import-package-flutter-gen-gen-l10n-app-localizations-anymore/
