Small knowledge, big challenge! This paper is participating in theEssentials for programmers”Creative activities.

preface

I have been writing Flutter using VSCode.

I didn’t set VSCode up very much before, but there is one feature that I am very comfortable with when I write Flutter. Once I change the code, VSCode will automatically be Hot Reload without doing anything.

But after I upgraded VSCode, this feature is inexplicably gone. You must manually run CMD + s to perform Hot Reload.

It was 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 VSCode configuration

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

  1. Open VSCode Settings:

  1. Search in the input boxdart.flutterHotReloadOnSaveWe can see that the default configuration is manual (manual). Only reload for manual saves

3. Change manual to always:

I used Flukit source code to modify the AppBar title and undo the modification, no save or other keyboard operations, just completed the Hot Reload function:

At this point, the Hot Reload autoresponse I’m used to is back.

Reference documentation

VSCode hot reload for flutter

conclusion

Is the so-called “a honey, b arsenic”.

I’m used to this kind of automatic Hot Reload, but some people prefer to save and then Hot Reload, because it’s possible that just changing the logic can trigger Hot Reload, which is not everyone’s favorite, and somewhat performance costly.

Android fans have suggested that I use Android Studio for Flutter development, but I am not used to it. I prefer VSCode, which is powerful enough and lightweight enough.

I have always used VSCode to write Flutter, but use Android Studio when building apk or JSON to Model.

We’ll see you next time.