VeryGoodOpenSource / very_good_cli

A Very Good Command-Line Interface for Dart created by Very Good Ventures 🦄

Home Page:http://cli.vgv.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fix: issue when using `flutter_gen` package in Very Good Core

SamuelAc1011 opened this issue · comments

Description
When the app was created with

very_good create flutter_app new_app_name --description "Random description" --org-name "123dev.happy.newapp"

The command dart pub get has an issue and it solves when I delete flutter_gen: any from the pubspec.yaml

Steps To Reproduce

This is the terminal response

D:\Flutter\bin\flutter.bat --no-color pub get
Resolving dependencies...

  • color 3.0.0
  • dart_style 2.3.4
  • dartx 1.2.0
  • flutter_gen 5.4.0
  • flutter_gen_core 5.4.0
    intl 0.18.1 (0.19.0 available)
    js 0.6.7 (0.7.1 available)
  • json_annotation 4.8.1
    leak_tracker 10.0.0 (10.0.4 available)
    leak_tracker_flutter_testing 2.0.1 (3.0.3 available)
    leak_tracker_testing 2.0.1 (3.0.1 available)
    meta 1.11.0 (1.12.0 available)
  • petitparser 6.0.2
    test 1.24.9 (1.25.2 available)
    test_api 0.6.1 (0.7.0 available)
    test_core 0.5.9 (0.6.0 available)
  • time 2.1.4
    vm_service 13.0.0 (14.0.0 available)
  • xml 6.5.0
    Changed 9 dependencies!
    10 packages have newer versions incompatible with dependency constraints.
    Try flutter pub outdated for more information.

Screenshots
image

My very_good version is 0.19.1

Hi @SamuelAc1011 thanks for opening an issue!

When I run:

very_good create flutter_app new_app_name --description "Random description" --org-name "123dev.happy.newapp"

My output is:

"123dev.happy.newapp" is not a valid org name.

A valid org name has at least 2 parts separated by "."
Each part must start with a letter and only include alphanumeric characters (A-Z, a-z, 0-9), underscores (_), and hyphens (-)
(ex. very.good.org)

If instead I run:

very_good create flutter_app new_app_name --description "Random description" --org-name "dev.happy.newapp"

My output is:

✓ Generated 314 file(s) (4.6s)
✓ Running "flutter packages get" in .  (2.3s)
✓ Running "dart fix --apply" in ./new_app_name (2.3s)


Created a Very Good App! 🦄
  • To get started refer to new_app_name/README.md
  • Your project code is in new_app_name

The host operating system I'm using is macOs 14.0 (23A344).


What is your host operating system? I think you are using Windows? If so, what Windows version?

Hi, I don't if this issue is correct or I have to open a new one. By the way, the usage of flutter_gen:any in pubspec file create issue with intl internationalization. Indeed, the import 'package:flutter_gen/gen_l10n/app_localizations.dart'; is not correctly recognized. It seems that the flutter_gen in pubspec shadows in some way the intl-generated package under .dart_tool.

The way to reproduce is simply create a new flutter app with very good cli.

I am on very_good_cli 0.20.0

@SamuelAc1011 @dariocast I ran into this and was able to resolve by making the prescribed changes from flutter_gen readme: https://github.com/FlutterGen/flutter_gen?tab=readme-ov-file#error-with-internationalization
Screenshot of code from flutter_gen github readme instructing user to delete the 'generate:true' line from the pubspec.yaml file and instead add the 'synthetic-package: false' line to the l10n.yaml file

As far as I am concerned there is no flutter_gen dependency being specified in Very Good Core's pubspec.yaml.

I suspect you've manually added this to the pubspec.yaml after the generation. If that's the case, I think @aymswick already provided a solution given you start using the flutter_gen package into your created application. Hence, I think this is an issue regarding your invalid usage of flutter_gen rather than the code being generated by Very Good CLI.

I'll be closing this issue, feel free to re-open if you think the issue still holds and is related to Very Good CLI. If you think the issue is related to the generated code consider opening the issue at Very Good Templates instead.

If you would like to suggest adding the flutter_gen package to the template let us know too with a feature request at Very Good Templates! 🙌

For posterity, I definitely run into this issue occasionally when I set up new projects and I know i don't go manually adding flutter_gen to the pubspec - it seemingly has something to do with either vscode, very_good_cli, or the flutter create commands itself, but since localizations is something very_good_cli sets up, it would make sense that something weird is happening in that domain. The steps to reproduce are unknown to me at this point other than just creating a new flutter_app from the very_good_cli and watching your app/view/app.dart and l10n files turn red to indicate an error. The error provided by the linter says something like "the uri for the package doesnt exist" when referencing the synthetic package produced by intl/localizations/flutter_gen:

import package:flutter_gen/gen_l10n/app_localizations.dart

Here's a reference to this issue from 3 years ago, it does seem to be related to the dart analyzer, perhaps there's been a recent regression.
#139

Dart-Code/Dart-Code#3438

Dart-Code/Dart-Code#3074

For posterity, I definitely run into this issue occasionally when I set up new projects and I know i don't go manually adding flutter_gen to the pubspec - it seemingly has something to do with either vscode, very_good_cli, or the flutter create commands itself, but since localizations is something very_good_cli sets up, it would make sense that something weird is happening in that domain. The steps to reproduce are unknown to me at this point other than just creating a new flutter_app from the very_good_cli and watching your app/view/app.dart and l10n files turn red to indicate an error. The error provided by the linter says something like "the uri for the package doesnt exist" when referencing the synthetic package produced by intl/localizations/flutter_gen:對於後代來說,當我設置新專案時,我肯定會偶爾遇到這個問題,我知道我不會手動添加到 flutter_gen pubspec 中——它似乎與 vscode、very_good_cli 或 flutter create 命令本身有關,但由於當地語系化是very_good_cli設置的東西,因此該領域發生一些奇怪的事情是有道理的。在這一點上,除了從very_good_cli創建一個新flutter_app並看著您的 app/view/app.dartl10n 變為紅色以指示錯誤之外,我還不知道重現的步驟。在引用 intl/localizations/flutter_gen 生成的合成包時,linter 提供的錯誤會顯示類似「包的 uri 不存在」的內容:

import package:flutter_gen/gen_l10n/app_localizations.dart

Here's a reference to this issue from 3 years ago, it does seem to be related to the dart analyzer, perhaps there's been a recent regression.這是 3 年前對這個問題的引用,它似乎確實與飛鏢分析器有關,也許最近出現了回歸。 #139

Dart-Code/Dart-Code#3438飛鏢代碼/飛鏢代碼#3438

Dart-Code/Dart-Code#3074飛鏢代碼/飛鏢代碼#3074

I'm new to Flutter and very_good_cli and face the same issue.

My Development Environment:
OS: macOS 14.2.1
very_good_cli: 0.20.0
Flutter: 3.19.2
Dart: 3.3.0