I've been learning Dart/Flutter on VS Code and the Hot Restart/Reload was always automatic (if I changed a color in the code, it automatically showed up on screen). I have to manually trigger the action now. I have no idea what changed.
I'm using VS Code and iOS emulator. I can't run SDK on Android Studio right because I'm on the new mac M1 processor.
Solutions I've tried:
Opened other Flutter projects and verified the hot restart isn’t
working on any of them (its not an import error like other posts have suggested)
I ensured that I can manually hot restart from VSCode and terminal to see changes
Flutter Doctor shows no errors
I ran Flutter Upgrade from the terminal anyway
I uninstalled and reinstalled Dart and Flutter from VS Code
I ensured VS Code’s autosave feature was on
I ensured VS Code’s “Dart: Flutter Hot Reload on Save” (and Restart) were both checked
I tried running with and without debugging
I restarted my computer and VS Code
Edit: I just installed Android Studio and cannot get an automatic hot reload here either. I connected it to iOS emulator, turned on automatic saving after 2 seconds of being idle, and still have to manually reload. Alternatively, I can go to the menu and click "Save All" and it will reload to update the UI (without me having to click a hot reload or restart icon). But, it's still manual.
Edit: 2/25/21: A "fix" has been introduced in the v3.20.0 beta.
https://dartcode.org/releases/v3-20/
Ok, I was finally pointed in the right direction for an answer.
Apparently, the automatic hot reload after an IDE autosave was a bug that some users found to be a useful feature. The intended functionality was to only trigger a hot reload on a manual activation. Thus, the bug (feature) was "fixed" taking this functionality away.
Feedback shown a light on the fact that some people found the bug useful and there is now an indication that this functionality will be returned in the future.
https://github.com/Dart-Code/Dart-Code/issues/3110
Edit: 2/25/21: A "fix" has been introduced in the v3.20.0 beta.
https://dartcode.org/releases/v3-20/
VSCode can be buggy sometimes and this problem is arguably the most annoying. I had this happen to me last week when I decided to use a barrel file with flutter web.
Meaning, I had a folder with all the components exported and then would import only that one file, like this
And then wherever I wanted all those files to be, I would add
import barrell.dart
Now this worked perfectly fine when I was working with flutter on mobile, and the second I went to flutter web my app would not hot reload.
I share this with you to say that I found out about this by a process of elimination. Took me a little bit, but I created a new project from the bottom up, added in each part one by one, and then I found that it was this barrell file that was messing the hot-reload up..
So my best advice is to do the same - start fresh with a new project, add back the pieces one-by-one and if you do find out what is causing the hang-up, I implore you to share it here:
https://github.com/flutter/flutter/issues
Related
I'm not really a coder but I use VS Code at work for various reasons on my mac.
If I move between VS Code and my browser, every time I open VS code it freezes for a moment. It freezes if I change tab or move file. Looking at my commit changes or doing anything with the in-built terminal doesn't cause it to freeze.
All the dependency packages are up to date. I've disabled all of the plugins and it still happens. VS Code is at the latest version, 1.67.0.
I really don't know what is causing it and would appreciate any help!
I'm trying to print('hi') inside Visual Studio Code's Debug Console using Dart/Flutter.
Whenever I perform a restart, it works just fine. As you can see in the debug console it prints: I/flutter: hi
Performing a restart takes up to one minute of loading time. This isn't very ideal.
Ideally I would prefer that print() displays on the console whenever I perform a hot reload (as this only a takes a few seconds).
Any help would be greatly appreciated!
You are running a flutter app. That's quite expensive even if your "app" is only a print. Depending on your machine, reloading or even restarting can take a while.
EDIT since the whole debugging setup required for flutter apps is run too.
If you want to run dart code only, consider creating a dart project without flutter.
Background:
When the project is already running (npm run start), and I make changes, and save. Then VS Code rebuilds and runs the project. Great!
But it is very frustrating when VS Code is running, and you look through the code (without changing or saving anything), then often VS Code rebuilds for no reason.
When this happens, one loses the DevTools browser inspector, and has to start all over again.
Questions:
So, is there a way to prevent VS Code from automatically rebuilding without having changed or saved anything?
And is it possible to keep the auto-rebuild-on-save functionality at the same time?
i didn't write any flutter code for a long time, when i came back i had a really annoying problem and it is slowing me down.
the code completion/suggestions (when hitting ctrl+space) is working fine, except when i want to see suggestions for a property of a widget.
i can't remember the specific update that messes this up, but when i go to download an older version of flutter, it seems the last working update is v1.0.0, after that the problem appears.
i've tried different PCs and IDEs, they all have the same problem.
screenshot of it working when pressing ctrl+space on:
Container(
alignment: // <<< Pressing Ctrl+Space here
)
another screenshot after the v1.0.0 update:
UPDATE: after trying for 6 hours, i figured out a workaround and knew the cause of the problem.
you have to download the latest version of Flutter SDK.
and the dart SDK version 2.1.1 from (https://dart.dev/tools/sdk/archive)
and only take two files:
First file: dart-sdk\bin\dart.exe and copy it to Flutter\bin\cache\dart-sdk\bin
Second file: dart-sdk\bin\snapshots\analysis_server.dart.snapshot and copy it to Flutter\bin\cache\dart-sdk\bin\snapshots
it's not a great solution but at least it works for now, you will lose all the features that were introduced after the 2.1.1 update.
I am VERY NEW to learning JavaScript, and I was looking for a simple way to test my basic JavaScript, without using the chrome developer tools inside my Chrome Browser. I thought it might be faster than hoping back and fourth to a browser and typing things in the browser's console.
I thought the extension "Debugger for Chrome" would aid in this, but I don't think it's what I want, or I can't figure out how to use it(very new to this)?
I am trying to uninstall it, and I just get a perpetual 'Uninstalling' icon, but it never actually uninstalls(pic attached below). It's been like that for a half hour in the background. I've tried restarting vscode and my PC, and I can't seem to get it out of my editor.
https://i.imgur.com/ip1dDB9.png
I even tried to delete vsCode completely, including the registry items I could get at, after reinstall I had the same error. Restarts of PC also didn't help. But for some reason, this morning after starting up my PC, I was able to remove the extension.
So my issue is resolved, not onto figuring out easier ways to debug with vsCode.