saeed z
saeed z

Reputation: 655

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?

Upvotes: 3

Views: 384

Answers (2)

Munsif Ali
Munsif Ali

Reputation: 6131

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

Upvotes: 1

j23
j23

Reputation: 43

Hi try to open your project in android studio and there you can find

External Libraries folder inside that you will find Flutter Plugin folder.

In that folder search for the file flutter_gen_runner in your project by using double shift, check which dependency is using flutter_gen_runner package and do necessary changes. This kind a worked for me and try deleting pubspec.lock file bcz that also creates the problem of dependency mismatch.

Upvotes: 0

Related Questions