场景
我正在使用基本计数器应用程序(在flutter create
之后(
预期功能
我想在VS代码中启用热重新加载:
1. increase the count
2. change the primary color + save file
3.1 see the color change
3.2 see the count stay the same (preserving state)
实际行为
在所有情况下(保存、在控制台中点击r(r(,甚至点击闪电图标(,我都会得到一个Restarted application in Xms
和一个热的重新启动。
1. increase the count
2. change the primary color + save file
3.1 color changes
3.2 count is reset to 0 (state is lost)
我尝试了什么
- 在手动和自动保存设置之间切换
- 将
dart.flutterHotReloadOnSave
设置为all
- 将
dart.hotReloadOnSave
设置为all
- 以
debug
和run
模式(ctrl+F5
和F5
(启动应用程序
我的设置
- Flutter
v3.3.2
- VS代码
v1.71
- 颤振扩展
v3.48.0
- 飞镖扩展
v3.48.3
Hot Reload仅适用于非web设备(台式机、移动设备(。在网络上,任何对热重新加载的调用都会触发热重新启动(因为这是最接近的可用功能(。
本期跟踪了web的热重新加载:https://github.com/flutter/flutter/issues/53041