问题
Flutter hot reloads
every time VS Code auto-saves
my project before. A few hours ago, I started experiencing this issue where auto-saving
doesn't hot-reload
my app. Pressing Ctrl+S
manually triggers hot reload
but auto-saving
does not. I've tried re-installing VS Code and Flutter SDK but the problem still exists.
My newly installed VS Code only has the following extensions and settings:
Dart: v3.19.1
Flutter: v3.19.0Auto-save
is set toafterDelay
of 1000ms
How do I hot reload when autosaving in vscode? Another person had the same issue two hours ago: https://github.com/Dart-Code/Dart-Code/issues/3110
回答1:
The latest version of Dart & Flutter's VS Code extension is causing the issue.
The only way to fix this for now is to downgrade both the Dart and Flutter extensions. Click on the arrow beside uninstall
in both Flutter and Dart extensions then install version 3.18.1
.
Edit: They are going to add a setting to enable hot reload
on auto-save
in the next release. Follow this issue for updates: https://github.com/Dart-Code/Dart-Code/issues/3110
回答2:
It's in the change notes for this release. It's an intended feature! (http://dartcode.org/releases/v3-19)
It says:
#3033: Hot-reload-on-save no longer fires for Save events triggered by VS Code’s auto-save feature. Pressing Save manually will still trigger a reload even if there are no unsaved changes.
Doesn't anybody read the release notes? :)
回答3:
Just delete your VS cache folder and VS temp folder.
-> Press windows button and type:
%temp%
%appdata%
-> Check your launch.json in .vscode folder. delete and recreate if necessary.
来源:https://stackoverflow.com/questions/65975713/flutter-hot-reload-doesnt-work-on-autosave-in-vscode