# Localized messages are generated into source, not a synthetic package.

> When using `package:flutter_localizations`, the default generated location (and eventually, only possible location) is within your source (`lib/`) directory, and not the synthetic package `package:flutter_gen`.




:::important
These breaking change docs are accurate, as of the release
under which they are published. Over time, the
workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up
to date as of each release.

这些破坏性改动文档的准确性仅限于其发布时对应的版本。
随着时间的推移，文档中描述的方案可能会逐渐失效。
通常情况下，我们不会在每次发布新版本时都对这些文档进行同步更新。

The [breaking change index file](/release/breaking-changes)
lists the docs created for each release.

[破坏性改动列表](/release/breaking-changes) 
列出了每个版本的文档。

:::


## Summary

The `flutter` tool will no longer generate a synthetic `package:flutter_gen`
or modify the `package_config.json` of the app.

Applications or tools that referenced `package:flutter_gen` should instead
reference source files generated into the app's source directory directly.

In addition, the property `generate: true` is now required when using generated
l10n source.

## Background

`flutter_gen` is a virtual (synthetic) package that is
created by the `flutter` command-line tool to allow developers to
import that package to access generated symbols and functionality,
such as for [internationalization][].
As the package isn't listed in an app's `pubspec.yaml`, and
is created via re-writing the generated `package_config.json` file,
many problems have been created.

## Migration guide

This change only affects apps that have the
following entry in their `pubspec.yaml`:

```yaml
flutter:
  generate: true
```

If your app previously used `gen-l10n` without this property, it is now
required.

A synthetic package (`package:flutter_gen`) is
created and referenced by the app:

```dart
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
// ...
const MaterialApp(
  title: 'Localizations Sample App',
  localizationsDelegates: AppLocalizations.localizationsDelegates,
  supportedLocales: AppLocalizations.supportedLocales,
);
```

There is one way to migrate away from importing `package:flutter_gen`:

 1. Specify `synthetic-package: false` in the accompanying [`l10n.yaml`][] file:

    ```yaml title="l10n.yaml"
    synthetic-package: false

    # The files are generated into the path specified by `arb-dir`
    arb-dir: lib/i18n

    # Or, specifically provide an output path:
    output-dir: lib/src/generated/i18n
    ```

## Timeline

Landed in version: 3.28.0-0.0.pre<br>
Stable release: 3.32.0

**In the next stable release after this change lands,
`package:flutter_gen` support will be removed.**

## References

Relevant Issues:

- [Issue 73870][], where `package:flutter_gen` pub problems are first found.
- [Issue 102983][], where `package:flutter_gen` problems are outlined.
- [Issue 157819][], where `--implicit-pubspec-resolution` is discussed.

Relevant Articles:

- [Internationalizing Flutter apps][internationalization],
  the canonical documentation for the feature.

[`l10n.yaml`]: /ui/internationalization#configuring-the-l10n-yaml-file
[Issue 73870]: https://github.com/flutter/flutter/issues/73870
[Issue 102983]: https://github.com/flutter/flutter/issues/102983
[Issue 157819]: https://github.com/flutter/flutter/issues/157819
[internationalization]: /ui/internationalization#adding-your-own-localized-messages

