Flutter and Dart extensions appear to be broken on VSCode - flutter

I opened VSCode a few days ago to continue work on a Flutter project, unfortunately, the Flutter and Dart usually take a while to start(2-3 minutes), but this time,the extensions failed to initialize, and I'm left with white colourless code and no access to the tools that come with the extensions(i.e F5 for debug).screenshot of the current state of things
Over the past few days, I have,
Deleted and re-installed the Flutter SDK(forgive me, I cant remember what version it was at before, but now its 3.3.7, Dart 2.18.4)
Deleted and re-installed VSCode(used to be a snap, now a .deb)
Uninstalled and re-installed the Flutter and Dart extensions(multiple times, restarted VSCode each time)
- Ran said project directly from the terminal to be sure I had the flutter tool correctly installed(flutter run and flutter build apk ran fine, with no errors)
Please find the results of 'flutter doctor -v' below
Flutter (Channel stable, 3.3.7, on Ubuntu 20.04.5 LTS 5.15.0-52-generic,
locale en_NG)
• Flutter version 3.3.7 on channel stable at
/home/alabi/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e99c9c7cd9 (7 days ago), 2022-11-01 16:59:00 -0700
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[!] Android toolchain - develop for Android devices (Android SDK version
32.1.0-rc1)
• Android SDK at /home/alabi/Android/Sdk
• Platform android-33, build-tools 32.1.0-rc1
• ANDROID_SDK_ROOT = /home/alabi/Android/Sdk
• Java binary at: /home/alabi/.jdks/openjdk-18.0.1.1/bin/java
• Java version OpenJDK Runtime Environment (build 18.0.1.1+2-6)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/linux#android-setup for
more details.
[✗] Chrome - develop for the web (Cannot find Chrome executable at
google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup
for detailed instructions).
[✓] VS Code (version 1.73.0)
• VS Code at /usr/share/code
• Flutter extension version 3.52.0
[✓] Connected device (1 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.5 LTS 5.15.0-52-generic
The CLI command, 'flutter --version' returns
Flutter 3.3.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision e99c9c7cd9 (7 days ago) • 2022-11-01 16:59:00 -0700
Engine • revision 857bd6b74c
Tools • Dart 2.18.4 • DevTools 2.15.0
All of this leads me to believe the Flutter SDK is installed correctly and the problem is with VSCode and the extensions
Any help is appreciated, thank you!

Make sure that you use official extensions for Flutter/Dart. They are created by Dart Code.

Fixed!
If something in the extension is corrupt you could try uninstalling the extensions and then deleting them from ~/.vscode/extensions (the ones starting dart-code) and then reinstall.
From DartCode's GitHub, read the issue and fix here if you're still confused

Related

Flutter VS code plugin stuck Waiting for connection from debug service on Chrome

I am using VS Code for Flutter developement since a long time and up until now, launching the web version from VS code has worked just fine. However, similar to what others have posted I now get a "Waiting for connection from debug service on Chrome...".
The Chrome window opens but the URL just says: "http://localhost:57698/" and the page is white.
If I click reload, the URL changes to "http://localhost:57698/#/" and the page loads correctly. This seem to match other peoples experience for this problem, that hot reloading or similar loads the page.
If I launch the web version from the command line with: "flutter run -d chrome" it also works fine. It is only when launching from VSCode it no longer works (and it has been ok for 2 years). I have tried to restart the whole computer as well as Chrome and VS code and I have done flutter clean, still the same. I have also tested on 2 different computers, no change. Is there some magic thing in Chrome that can get stuck or what could have happened?
My flutter doctor says that all is ok:
[✓] Flutter (Channel stable, 2.10.5, on macOS 13.2 22D49 darwin-arm, locale en-ES)
• Flutter version 2.10.5 at /Users/johanlantz/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5464c5bac7 (10 months ago), 2022-04-18 09:55:37 -0700
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at /Users/johanlantz/Library/Android/sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• 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 11.0.11+0-b60-7772763)
[✓] VS Code (version 1.74.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.58.0
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Downgrading the dart and flutter VS code plugins from 3.58.0 to 3.56.0 fixed this (on two separate MacBooks with the same issue).
The latest version of the plugin switched to a new API (because an old API is being removed). Unfortunately when running on the web, it appears as if the new API is available (the VM Service version number is high enough), but the API is unfortunately not actually available.
A fix is on the way - you can get it early by switching to the Pre-Release version of the extension:

Strange syntax error with flutter_localizations and intl

Recently (today) I tried to create an app for web and desktop with Flutter and wanted it to be in multiple languages (English, French, Arabic, Dutch...) so I looked at Flutter's tutorial and followed every steps it had. And just after finishing the last step I had it working ! I could add text in, English in the app_en.arb file and in any other language in app_fr.arb by example. When I hot reloaded/restarted my app the Dart files it generates are rebuilt. But now when I do that I have an error that I couldn't find anywhere else on Internet:
Exception: Found syntax errors.
And the dart files for localization weren't rebuilt. Now I must use the
flutter gen-l10n
command to rebuild my language files.
Note:
Here's my flutter doctor:
[✓] Flutter (Channel master, 3.7.0-10.0.pre.33, on Fedora Linux 37 (Workstation Edition) 6.0.12-300.fc37.x86_64, locale fr_FR.UTF-8)
• Flutter version 3.7.0-10.0.pre.33 on channel master at /home/theskyblockman/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cee3e6cc3d (il y a 8 heures), 2022-12-17 04:03:24 -0500
• Engine revision b107699980
• Dart version 3.0.0 (build 3.0.0-35.0.dev)
• DevTools version 2.20.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /home/theskyblockman/Android/Sdk/
• Platform android-33, build-tools 33.0.0
• Java binary at: /home/theskyblockman/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[✓] Android Studio (version 2021.3)
• Android Studio at /home/theskyblockman/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738
• Flutter plugin version 71.0.3
• Dart plugin version 213.7433
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] IntelliJ IDEA Community Edition (version 2022.2)
• IntelliJ at /home/theskyblockman/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/222.4459.24
• Flutter plugin version 71.0.5
• Dart plugin version 222.4459.16
[✓] VS Code (version 1.74.0)
• VS Code at /usr/share/code
• Flutter extension version 3.54.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Fedora Linux 37 (Workstation Edition) 6.0.12-300.fc37.x86_64
• Chrome (web) • chrome • web-javascript • Google Chrome 110.0.5464.2 dev
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
it's me again, this looked like a PATH problem in my case. Now that I restarted my computer I don't have the error anymore, I should have checked that before. But as I never saw this error before you should check other things like dependencies versions or your Dart and Flutter SDKs, I am not sure about how it happened so restart your computer and check a lot of things could help fix the problem.
In my case this error had appeared after I renamed the folder where project files was. I fixed all paths with old folder name, but the error was still persist. flutter clean didn't help.
Then in folder named .idea I found few files (.xml and .iml extensions) that contained the old folder's name. After I fixed it the error was gone. Hope will help.

How to fix Chrome showing an empty / transprarent window for a Flutter web app on Linux?

When I run a Flutter web app in Chrome using Android Studio I only get an empty / transparent window on my Linux Mint 20.2 system.
empty / transparent chrome window of flutter web app
I have already tried reinstalling Chrome, which did not help. I have tried different Flutter projects including a fresh demo project (with web support), but the transparent screen shows up regardless. The same result shows up when I run flutter run -d chrome.
Anyone know how to fix this?
These are the results of flutter doctor -v:
flutter doctor -v
[✓] Flutter (Channel stable, 2.10.3, on Linux Mint 20.2 5.14.0-1032-oem, locale en_US.UTF-8)
• Flutter version 2.10.3 at /home/janik/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (5 weeks ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /home/janik/Android/Sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /opt/android-studio
• Flutter plugin version 66.0.1
• Dart plugin version 211.7811
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
• IntelliJ at /opt/idea-IU-203.7148.57
• 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
[✓] VS Code (version 1.66.1)
• VS Code at /usr/share/code
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.75
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
this seems like an issue with the latest chrome update so I expect this to be fixed soon, meanwhile as a workaround what it worked for me and I suggest you do is to use chromium instead, which works.
Install chromium and find its executable which chromium, for me is use/bin/chromium and the version of chromium installed is: Version 83.0.4103.116 (Developer Build) built on Debian bullseye/sid, running on Debian bullseye/sid (64-bit), I am running Pop O.S 20.04, Dart 2.16.1 • DevTools 2.9.2, Flutter 2.10.2 • channel stable.
In the terminal where you will run the flutter app export a variable pointing to chromium: export CHROME_EXECUTABLE=/usr/bin/chromium, now you can run:
flutter run -d chrome and it will actually use chromium which renders the window properly.
I would expect this to be fixed soon, I will open an issue on the flutter repo if it's not there yet.
Good luck.
I don't have answer, only similar problem. Mint 20.2 Ryzen 3 2200G with Radeon Vega Graphics. Transparent window in Chrome using Android Studio AND ALSO in Visual Studio Code, even when creating a new (demo) project without any own code. But Pixel mobile emulator works, no problem in 'virtual' phone!! So, is this chrome-related problem? This problem emerged a few weeks ago.
I had similar issue but clearing Chrome’s cache worked like a charm

Unable to create Flutter Project anywhere in windows

I have made many flutter projects, but suddenly I am unable to create a project. I thought it was an issue with VSCode, so, I installed the latest version. Didn't work! Then I tried in Android Studio. It got stuck at 'Creating Flutter Project'. I even tried in CMD. It remains stuck at
Running "flutter pub get" in note ...
Got TLS error trying to find package cupertino_icons at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 1 in 1 second
This is flutter doctor -v
[√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18363.657], locale en-IN)
• Flutter version 1.17.5 at C:\flutter
• Framework revision 8af6b2f038 (13 days ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\nithi\AppData\Local\Android\sdk
• Platform android-30, build-tools 29.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)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.47.0)
• VS Code at C:\Users\nithi\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.12.2
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
I looked into other answers.
Flutter SDK is stored at C:\flutter
I feel something is wrong with the SDK itself.
Can someone help me with this issue?
EDIT
This is flutter upgrade
Flutter is already up to date on channel stable
Flutter 1.17.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8af6b2f038 (13 days ago) • 2020-06-30 12:53:55 -0700
Engine • revision ee76268252
Tools • Dart 2.8.4
Apologies for the lateness in this.
If this is in a Corporate work environment, there may be a 'man in the middle' security scanning app that's preventing the project from being created.
I was using Flutter just fine until my company instituted 'Zscaler'. Since that got implemented, I'd also freeze at that same error message. I had to turn Zscaler off for my Flutter projects to create.

Unable to locate a development device; please run 'flutter doctor' .. but doctor checks out ok

A new installation of flutter/dart went smoothly without issue .. running "flutter doctor -v" gives the following output:
$ flutter doctor -v
[✓] Flutter (Channel beta, v0.11.9, on Linux, locale en_AU.UTF-8)
• Flutter version 0.11.9 at /home/jedaa/bin/flutter
• Framework revision d48e6e433c (3 days ago), 2018-11-20 22:05:23 -0500
• Engine revision 5c8147450d
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.2)
• Android SDK at /home/jedaa/bin/Android/sdk
• Android NDK location not configured (optional; useful for native
profiling support)
• Platform android-28, build-tools 28.0.2
• ANDROID_HOME = /home/jedaa/bin/Android/sdk
• Java binary at: /opt/android314/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-
b06)
• All Android licenses accepted.
[✓] Android Studio (version 3.2)
• Android Studio at /opt/android314
• Flutter plugin version 30.0.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-
b06)
[✓] IntelliJ IDEA Community Edition (version 2018.2)
• IntelliJ at /opt/idea
• Flutter plugin version 30.0.2
• Dart plugin version 182.5124
[✓] VS Code (version 1.29.1)
• VS Code at /usr/share/code
• Flutter extension version 2.20.0
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
and yet attempting to run the defalut starter app "flutter/material.dart" results in ... "Unable to locate a development device; please run 'flutter doctor' for information about installing additional components" ... irrespective whether i use Intellij or Visual Studio.
However,
$ flutter devices
1 connected device:
Pixel XL • HT69R0205363 • android-arm64 • Android 9 (API 28)
I have searched the web and found similar complaints .. but no solution. I was hoping that someone might be able to throw some light on this as I am sure it must be something simple and straight forward.
Visual Studio is a new installation but I have been using Intellij now for 6 months on a daily basis and rarely have issue with it .. especially one that i cannot fix. :)
Thank you in advance.
open Terminal in Android Studio or VS Code.
and writes this command :
flutter config --android-sdk <sdk-location>
SDK-location is your Path for SDK! for Example :
flutter config --android-sdk /home/sanaebadi/Pasport/programming/and_dev/sdk/sdk-tools-linux-3859397/
I had the same problem , then I tried this solution , and it helped me and my flutter app is running on my phone ..
all you need to do is install Android API level 29 (Android 9.0+ "Q")
go to Setting > Android SDK >SDK platform>Check Android 9+ and Press Apply button
I found this solution from github .. her is the link ..
Hope this help you
https://github.com/flutter/flutter/issues/22649#issuecomment-520472515
In Android Studio, ensure that the API level of your Project SDK (File->Project Structure) <= of the API level of your AVD.