fix: flutter_gen breaks current template
NonymousMorlock opened this issue Β· comments
Description
After updating to very_good cli v0.20, and running create, it outputs a flutter project that depends on flutter_gen: any
, so that when you run pub get, the l10n.dart
errors out.
Target of URI doesn't exist: 'package:flutter_gen/gen_l10n/app_localizations.dart'.
Steps To Reproduce
- Update your very_good_cli to v0.20
- Create new flutter project
- Open project in IDE
- Run
pub get
- See error
Expected Behavior
Should compile successfully after running pub get
Additional Context
The template for the previous version of very_good_cli
doesn't explicitly add flutter_gen
to pubspec.yaml
Same here β
I fixed that with removing flutter_gen
package dependency from pubspec.yaml
.
I think since flutter_gen
is already in pub.dev(link), and dart resolves flutter_gen
with that package, so the generated code in .dart-tool
is not used.
I fixed that with removing
flutter_gen
package dependency frompubspec.yaml
. I think sinceflutter_gen
is already in pub.dev(link), and dart resolvesflutter_gen
with that package, so the generated code in.dart-tool
is not used.
Yeah, hopefully they fix it so we don't have to manually do that every project
Somewhat duplicate of #973. I haven't been able to reproduce this myself, and the template itself doesn't seem to have flutter_gen: any
explicitly defined in its pubspec.yaml
.
@wolfenrain can you try to reproduce?
Then it could be from another source, maybe flutter create, as one of the comments in the issue you referenced suggests. and from what I see in that issue, this problem has been since before 0.20, but I've personally never encountered it since I started using very_good_cli and it's been a couple years, this is my first time encountering this. so it could be a random occurrence. I tried to create a new project tho and the same happened.
Somewhat duplicate of #973. I haven't been able to reproduce this myself, and the template itself doesn't seem to have
flutter_gen: any
explicitly defined in itspubspec.yaml
.@wolfenrain can you try to reproduce?
I haven't been able to reproduce this here locally either. @NonymousMorlock can you maybe provide the output of flutter doctor
. Just to ensure that we can reproduce it in a similar environment as you have.
I haven't been able to reproduce this here locally either. @NonymousMorlock can you maybe provide the output of
flutter doctor
. Just to ensure that we can reproduce it in a similar environment as you have.
[β] Flutter (Channel stable, 3.19.0, on Fedora Linux 39 (Workstation Edition)
6.7.7-200.fc39.x86_64, locale en_US.UTF-8)
[β] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[β] Chrome - develop for the web
[β] Linux toolchain - develop for Linux desktop
[β] Android Studio (version 2023.1)
[β] VS Code (version 1.87.0)
[β] Connected device (2 available)
[β] Network resources
β’ No issues found!
@wolfenrain I just encountered this today - happy to reproduce it together later this week if you'd like.
@craiglabenz NOOOOOOOOOOO WAYYYYYYYYYYY...I'm freaking out right now. Big fan, no no, Biggest FANNN, no way you're in my issue ππππππ
Hi, I think I've found the reason.
After I execute dart fix
, the following fix is made:
pubspec.yaml
MISSING_DEPENDENCY β’ 1 fix
This is triggered by importing package:flutter_gen
without declaring it inside pubspec.yaml
. So dart fixer automatically add the flutter_gen: any
line inside it.
If very good cli executes dart fix
automatically after setup, this could be the reason.
As of current date and time this issue still persist. Today I updated all my IDE and tools to make a new flutter app. I got the same issue.
Strangely, If i create a project using the very_good cli in old directory, this issue didn't appear. I tried making new folder in documents and created a new project using very_good. Then there seem to be issue.
Note: this could be false positive or something to do with directory permission. But i fix it by removing flutter_gen: any in pubspec.yaml
As of current date and time this issue still persist. Today I updated all my IDE and tools to make a new flutter app. I got the same issue.
Strangely, If i create a project using the very_good cli in old directory, this issue didn't appear. I tried making new folder in documents and created a new project using very_good. Then there seem to be issue.
Note: this could be false positive or something to do with directory permission. But i fix it by removing flutter_gen: any in pubspec.yaml
I solved by remove flutter_gen too. because flutter_gen already building with flutter