localizely / flutter-intl-vscode

This VS Code extension generates boilerplate code for localization of Flutter apps with official Dart Intl library
MIT License
87 stars 1 forks source link

No Flutter Project Detected #53

Closed maylortaylor closed 3 years ago

maylortaylor commented 3 years ago

Every time I run the VSCode command Flutter Intl: Initialize I get an error from VSCode saying "No Flutter Projects Detected".

This is a new install of Windows 10. Just installed Android Studio + Dart & Flutter plugins. Then installed VSCode + Dart & Flutter & Flutter Intl extensions.

flutter doctor -v [√] Flutter (Channel beta, 1.23.0-18.1.pre, on Microsoft Windows [Version 10.0.19042.630], locale en-US) • Flutter version 1.23.0-18.1.pre at C:\flutter\flutter • Framework revision 198df796aa (5 weeks ago), 2020-10-15 12:04:33 -0700 • Engine revision 1d12d82d9c • Dart version 2.11.0 (build 2.11.0-213.1.beta)

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at C:\Users\maylo\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.2 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[√] Android Studio (version 4.1.0) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.51.1) • VS Code at C:\Users\maylo\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.16.0

[!] Connected device ! No devices available

! Doctor found issues in 2 categories.

lzoran commented 3 years ago

Hi @maylortaylor,

Thanks for reporting this! I've tried to reproduce this issue, but without success, everything works fine on my machine. 😕

Note that Flutter Intl extension only treats projects with the pubspec.yaml file that has flutter as a dependency as Flutter projects. Could you check if you have flutter as a dependency in the pubspec.yaml file of your project?

dependencies:
  flutter:
    sdk: flutter
maylortaylor commented 3 years ago

Yes i do have Flutter as a dependency.

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
flutter_localizations:
  sdk: flutter
  intl: 0.16.1
  generate: true
  flutter_intl:
    enabled: true
  mvc_pattern: ^6.6.0
  path_provider: ^1.6.24
  cupertino_icons: ^1.0.0
maylortaylor commented 3 years ago

I just created a new Flutter project using VSCode's Create New Flutter Project command and everything works fine.

The first project I was working with was a New Flutter Project created by Android Studio 4.1.1

lzoran commented 3 years ago

Hi @maylortaylor,

Interesting... I've tested it again with the Flutter project created by Android Studio 4.1.1, and it works well. Not sure what may cause this issue... 😕

Regarding the list of dependencies you've posted above, it looks like indentation is not well there and that some things do not belong to the dependencies section of the pubspec.yaml file (e.g. generated: true, flutter_intl: ...). Not sure if that is a copy-paste mistake and if that has something with this problem.

ChauCM commented 2 years ago

@lzoran I got this error if my workspace is at the parent folder of the app. So pubspec.yaml will locate in myproject/myapp/pubspec.yaml instead. Is there a way to point the extention to pubspec.yaml instead of open another vscode window just for myapp

lzoran commented 2 years ago

Hi @ChauCM,

The Flutter Intl extension will go through your workspace and try to find Flutter projects (directories with the pubspec.yaml file in the root).

Note that you can have multiple projects in your workspace or open each one in a separate window.