vscode fails to HotReload on latest Flutter version - visual-studio-code

After latest Flutter 1.0 stable and Dart update to vscode, I,m unable to use hotreload from vscode. If I run it from a terminal everytnhing works fine. Flutter doctor has no complains and I'm not sure how to fix it. I tried to uninstall flutter and dart from vscode but no luck so far. The error I get is
../../third_party/dart/runtime/vm/object.h: 8954: error: Handle check
failed: saw Instance of 'HomePage' expected Closure
I searched to find a solution but so far no luck.

This appears to be a bug in Dart or Flutter. It's possible it's the same as this one:
https://github.com/flutter/flutter/issues/24710
Can you reproduce in a small sample that you could easily attach to that issue and add some notes on your environment (what platform, what device, etc.) and if you get a full stack trace dumped when this happens, include that too.
Thanks!

Related

VScode Dart/Flutter not working out side of terminal?

All I wanted was to make a simple flutter/dart calculator in VS code... but I've been suffering tech issues for the last 2 days trying to get it working.
Right now my problem is basically VS code is unresponsive outside of the terminal I think.
Example: in terminal when I run 'flutter doctor -v' I get
running flutter doctor in terminal
As you can see everything works fine, but when I do ctrl+shift+p and run flutter doctor it never finishes loading in the bottom right, just stating 'flutter doctor -v: running...' same with when I run Flutter: New Project.
Also when I select the No Device in the bottom right of the VS code screen to choose an emulator to run it does the same thing, just loading for ever... I have no clue why. I followed about 10 youtube tutorials on how to set up VS code for flutter, after non of them worked I uninstalled and reinstalled VS code, Android Simulator, flutter, cleared settings and fresh installing each and this problem persists.
Please check you are on the latest version of VS Code and the Dart extension. This issue should've been resolved in the Dart extension version v3.38.0.
https://github.com/Dart-Code/Dart-Code/issues/3877
If you still see this in the latest version, please file an issue on GitHub for me to take a look.

flutter not showing devices in VS code and flutter commands also not working

I face this problem after every 2,3 days that VS code doesn't show devices even they don't show chrome or edge. Then I run flutter commands but flutter commands are also not working. no error, no output in CMD. Please tell me how to solve this problem.
This issue is caused by an extension.
This was how I solved my mine
just search for the extension uninstall or disable it.
Restart your vscode again.
Happy coding

flutter error Could not find an option named "platforms"

I'm new to learning flutter when I try to crate a new project on android studio gives me a arror message in the event section enter image description here
The MESSAGE: [Could not find an option named "platforms". Run 'flutter -h' (or 'flutter -h') for available flutter commands and options.]
And another problem is flutter doctor does not see the android studio enter image description here
1(By the way, I want to use this version of flutter, please do not give a suggestion like update.)
2(this problem did not exist before, it happened after turning my computer off and on)
And sorry for my english mistakes
Thank you.
flutter version flutter_windows_v1.12.13+hotfix.9-stable
andorid studio version: 4.1.3
Is this the answer to your question about andorid studio?
and you need to install JDK
You are using the wrong flutter SDK. Too low information in your question. Make sure that you have the right path to flutter SDK in your IDE. Check that the flutter SDK directory has the appropriate structure, all needed files and cetera. Channel and version of flutter also may have an influence on this problem.
Got this today out of nowhere. Things were going well, but suddenly when I tried to relaunch the app from fresh, for the error Could not find an option named "target"
UPDATE:
This appears to happen when I switch branches and merge while app is running/flutter is attached. If you're using VS Code,
open your launch.json
change something, I decided to change type: "dart" to type: "notdart"
save
try to debug which fails
then revert that change.
This should fix the issue.
Previous Answer/If you're not using VS Code
What worked for me was to
flutter clean
close the editor (VS Code for me)
close the emulator
give a minute for things to close down
open task manager and kill any left over processes of dart.exe flutter.exe and java.exe and adb.exe (was doing Android)
start VS Code/Android Studio and try to debug again. (when prompted I chose to cold boot the emulator as well)
This takes a while as the emulator has to cold boot and since flutter clean was run, the compilation hadto start from scratch as well.

Weird behavior of flutter and dart commands in PowerShell and CMD

I'm relatively new to Flutter but I already have developed and finished some Apps in Flutter.
Recently I noticed a weird behavior of commands with the keywords "dart" or "flutter" in it.
Here is an example:
I was trying to migrate an existing project to the new dart null-safety and typed the command dart migrate into my Visual-Studio-Code Terminal.
I was expecting an output like Migrating C:\.... as a response but instead got these three lines:
The command "git" is either misspelled or could not be found.
Building flutter tool...
Running pub upgrade...
and then the expected output:
Migrating C:\<project path>...
and so on.
So basically the commands work as they would normally do but I get these three lines before the output everytime. And it's not only with this command. Also basic commands like dart help or flutter doctor will get these three lines.
I don't know what I am doing wrong. I uninstalled Flutter and also removed it from the PATH and then reinstalled it freshly but it's still the same. I also searched the web but didn't found anyone who has the same problem.
Any help and explanation would be great. Thank you for your time :)
I think I know where the problem is. I ran the commands directly when I opened PowerShell. But the directory was something like C:\Windows\ and then it won't work.
After I did cd C:\Users\User all commands will work as expected.
I was just thinking that it doesn't matter from where I run dartand fluttercommands obviously you have to be in your user directory that they will work properly.

"flutter doctor" stucked, none of the flutter command working

I am running flutter on my windows machine, it was working earlier and I have created demo project with it.
Today when I run VSCode it asked me to update flutter and I did, but when it is updated it is not able to run any command. It doesn't do anything, neither error nor success. It just get stucked with any flutter command.
Note : It was working earlier, so there is no chance of setting environment variables, still I have double checked it and it is there.
I did not find any solution for this so the last available approach for me was to reinstall flutter SDK and it worked.
Note: If you are windows user, you might get an error about PowerShell version, you must have PowerShell version greater than 5.1