Home  >  Article  >  Development Tools  >  How to configure VSCode to realize automatic response of Flutter and Hot Reload!

How to configure VSCode to realize automatic response of Flutter and Hot Reload!

青灯夜游
青灯夜游forward
2021-10-25 11:13:573022browse

VSCodeHow to write Flutter and Hot Reload automatically respond? The following article will introduce to you how to configure VSCode. I hope it will be helpful to you!

How to configure VSCode to realize automatic response of Flutter and Hot Reload!

I have been using VSCode to write Flutter.

I didn’t set up VSCode much before, but when I was writing Flutter, there was a function that I was very comfortable using, that is, Once I rewrote the code, VSCode would automatically Hot Reload is performed.

But after I upgraded VSCode, this function disappeared inexplicably. You must manually execute cmd s before executing Hot Reload. [Recommended study: "vscode tutorial"]

It was obviously automatic before, but now it is manual, but I am not used to it, so I decided to check how to change this configuration.

Modify the configuration of VSCode

After a fierce search on the Internet, I finally found the configuration method, and now I share it:

1. Open the VSCode settings:

How to configure VSCode to realize automatic response of Flutter and Hot Reload!

2. Search dart.flutterHotReloadOnSave in the input box. We can see the default configuration manual at this time, only reload for manual saves, If and only when saving manually, start reload

How to configure VSCode to realize automatic response of Flutter and Hot Reload!

##3. Replace

manual with always:

How to configure VSCode to realize automatic response of Flutter and Hot Reload!

Let’s take a gif to see the effect. I used the source code of Flukit. After modifying the title of the AppBar and undoing the modification,

it was completed without saving or other keyboard operations. Hot Reload function:

屏幕录制2021-10-21 10.31.28.2021-10-21 10_37_07.gif

At this point, the

Hot Reload automatic response function I am used to is back.

Reference Document

https://stackoverflow.com/questions/49210769/vscode-hot-reload-for-flutter

Summary

As the saying goes, "A is like honey, B is like arsenic".

I am used to this automatic response to Hot Reload, but some people are more accustomed to saving and then Hot Reloading, because it may just change the logic to trigger Hot Reloading, and not everyone likes it, and more or less Consume performance.

Although Android kids have suggested that I use Android Studio for Flutter development, I'm still not used to it. I prefer VSCode, which is powerful enough and light enough at the same time.

I have always been used to writing Flutter through VSCode, but I use Android Studio when building apk or converting JSON to Model.

See you next time.

For more programming related knowledge, please visit:

Programming Video! !

The above is the detailed content of How to configure VSCode to realize automatic response of Flutter and Hot Reload!. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:juejin.cn. If there is any infringement, please contact admin@php.cn delete