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). Import the file from its real location:
// 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:
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). 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?.
Published Oct 9, 2026 · Markdown version