flutter 如何保存代码时自动热重载?

阅读了热重载相关文档: https://flutterchina.club/hot-reload/

但是这样每次修改完代码,保存后还需要按一次 r, 极其麻烦。

请问如何设置当按了 ctrl + s 保存代码后自动 热重载 呢?

像 react-native 一样

编辑器使用的是 vscode

阅读 7.5k
2 个回答

文档上按r是因为在终端运行的
如果你的vscode安装了flutter插件,可以直接在vscode按F5运行,这样默认就会保存就自动热重载

There's an extension for that,called Dart Code and another one named Flutter Code

They will detect that your project is a Dart/Flutter project. And allows you to debug it + hot reload using f5.

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题