Flutter hot reload doesn't work on autosave in VSCode

我的未来我决定 提交于 2021-02-05 07:48:43

问题


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.0
Auto-save is set to afterDelay 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!