flutterdartdeprecated

How to resolve "Synthetic package output (package:flutter_gen) is deprecated" warning in Flutter 3.29.0?


After upgrading Flutter to version 3.29.0 and Dart to version 3.7.0, I started seeing the following warning in the console when running my app on both Android and iOS:

Synthetic package output (package:flutter_gen) is deprecated: https://flutter.dev/to/flutter-gen-deprecation.
In a future release, synthetic-package will default to false and will later be removed entirely.

In pubspec.yaml

flutter:
  generate: true

What I've tried so far:

✅ Running flutter clean and flutter pub get.

✅ Upgrading all dependencies to the latest versions.

✅ Searching for a flutter_gen.yaml file in my project, but I don’t have one.

Questions: How can I properly update my project to avoid this warning?

Do I need to manually create a flutter_gen.yaml file to configure synthetic-package: false? If so, where should it be placed?

Is there an official migration path to handle the removal of synthetic-package for flutter_gen?


Solution

  • How to Update Your Project:

    The migration guide provide two ways to migrate the project.

    1. Modify Your l10n.yaml File: Set synthetic-package: false to stop using the virtual package.

      Here's an example of what your l10n.yaml might look like:

    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
    
    1. Enable the explicit-package-dependencies feature flag:
    flutter config --explicit-package-dependencies
    

    More details about migration guide can be found on this page. https://docs.flutter.dev/release/breaking-changes/flutter-generate-i10n-source#migration-guide

    and this is not yet released in stable version don't know why are you getting this in v3.29.0