Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable autoformat in VS Code for dart

So i wanted to work on my app but suddenly when i save, the document autoformats. Yesterday i had no problems but now i have. I have checked by autoformatting but that is off. When i opened VS Code i got a message to set dart for default language or something like that, maybe that is the problem?

I want it this way:

      theme: ThemeData(
      backgroundColor: Colors.white70,
      primarySwatch: Colors.blue,
      brightness: Brightness.light
    ),

But i get it this way:

      theme: ThemeData(
      backgroundColor: Colors.white70,
      primarySwatch: Colors.blue,
      brightness: Brightness.light),
like image 226
ARVOCI Avatar asked Jul 14 '20 07:07

ARVOCI


People also ask

How do I turn off autoformat in VSCode?

Enable/Disable Format On SaveOpen up VSCode Command Palette by pressing Ctrl + Shift + P. Search and select Open Settings (UI). Just start typing and it will auto-fill. Once there's a match, you can hit enter immediately, or manually click on the right option.

How do you autoformat in VS code?

The code formatting is available in Visual Studio Code (VSCode) through the following shortcuts or key combinations: On Windows Shift + Alt + F. On macOS Shift + Option + F. On Linux Ctrl + Shift + I.

Can I code dart in VSCode?

With the Dart plugin, you can use Visual Studio Code (VS Code) to develop Dart apps. The Flutter site has details on how to set up and use VS Code for Flutter apps.

Does prettier work with dart?

VSCode: Prettier does not work with Dart Flutter.

Is there a way to change the formatter settings in Dart-code?

However, for some reason only Dart-Code.dart-code works! You could change the global setting to Dart-Code.dart-code if you wish (and save having to mess with the settings.json file), however its cleaner just to add it to the file in the Dart section so you are not affecting your global formatter settings in VS Code. Show activity on this post.

How to enable debug view in Dart with VS Code?

You can set copy these from the JSON to your VS Code User Settings or by run the Dart: Use Recommended Settings command from the VS Code command palette. { // Causes the debug view to automatically appear when a breakpoint is hit.

How do I Turn OFF Auto everything in VS Code?

There should be a universal law that forces all IDEs and editors to include one setting to disable all auto-everything. Every single IDE makes this incredibly difficult. Use vs-code default shortcut keys ctrl+k with ctrl+shift+s (windows) for saving without formatting. Alternatively press ctrl+shift+p and search for save without formatting.

How do I Turn on auto-format in Visual Studio Code?

If your code editor of choice is VS Code, here’s how you can find Prettier, a popular code formatter, and turn on the auto-format feature. Open Visual Studio Code on your computer. Navigate to the extension tab on the left side of the screen. It’s represented as four blocks. In the search bar field, enter “Prettier code formatter.”


3 Answers

config file .vscode/settings.json

{
    "editor.formatOnSave": false,
    "[dart]": {
        "editor.formatOnSave": false
    }
}
like image 103
xiebin Avatar answered Sep 22 '22 15:09

xiebin


I found the problem This should be on flutter. It was first null.

enter image description here

like image 22
ARVOCI Avatar answered Sep 22 '22 15:09

ARVOCI


I found another solution that worked like a charm. I've tried many other solutions but nothing. Just go to Settings and type dart: enable sdk formatter and turn it off. Quit and open VS Code to apply the changes.

like image 13
José Pulido Avatar answered Sep 22 '22 15:09

José Pulido