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

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

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

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

像 react-native 一样

编辑器使用的是 vscode

阅读 7.8k
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.

推荐问题