Prevent VS Code from Auto Formatting Flutter/Dart Code

Updated: August 19, 2022 By: A Goodman 4 comments

By default, VS Code (Visual Studio Code) will automatically format your code when you save a Dart file. In general, this feature is useful and automatically makes your code cleaner, and has a consistent arrangement. However, there might be cases where this thing doesn’t fit your need. In these situations, you can turn off that format-on-save feature. The steps below will show you how to achieve the goal.

1. Click on “Dart” which locates in the bottom bar of your VS Code window (you need to open a Dart file to see it):

2. Now, you’ll see a list of options. Select “Configure ‘Dart’ language based settings…” from the drop-down:

3. In the settings.json file, change “editor.formatOnSave” from “true” to “false”:

Save the file, and your setup is done.

Further reading:

You can also take a tour around our Flutter topic page and Dart topic page to see the latest tutorials and examples.

Subscribe
Notify of
guest
4 Comments
Inline Feedbacks
View all comments
Enbidi
Enbidi
1 year ago

Very clean

kev
kev
1 year ago

Great, thank you bro!!

Josue Herrera
Josue Herrera
2 years ago

Works for me.
Thank you.

Luke Smith
Luke Smith
3 years ago

Nice, thanks 🙂

Related Articles