Description
Update as of 2024-02-18: https://docs.flutter.dev/release/breaking-changes/flutter-generate-i10n-source.
Currently, flutter_gen
is a virtual package we generate to provide certain functionality (e.g. internationalisation). Developers have to import that package into their app. The package itself is not listed in their app's pubspec.yaml
, though. Instead, the flutter_gen
package is made available by a rewrite of the package config file itself.
This "hack" has caused issues with multiple tools in the past, e.g.:
- build_runner ([build_runner 1.10.3] Bad state: Unable to generate package graph dart-lang/build#2835)
- linter (specifically, the
depend_on_referenced_packages
lint,depend_on_referenced_packages
triggers falsely on virtualflutter_gen
package dart-lang/sdk#58690) - Dart Code (AppLocalizations class from flutter_gen does not show in completion/have import fix Dart-Code/Dart-Code#3948)
- pub (mentioned in
depend_on_referenced_packages
triggers falsely on virtualflutter_gen
package dart-lang/sdk#58690)
It's expensive for tooling to have to handle package:flutter_gen as a special case and it's easy to overlook that special support for it is needed resulting in a sub-par user experience.
We should rethink whether there are better ways to support the functionality that flutter_gen
is currently providing that's more aligned with the dart ecosystem and its tooling. Maybe the upcoming support for macros in Dart can help with that).