extension 'flutter' cannot format '.dart'
See original GitHub issueEnvironment
- vscode: 1.43.0
- flutter extension: 3.8.1
- dart extension: 3.8.1
- settings.json
{
"editor.fontSize": 13.5,
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "Dart-Code.flutter"
}
Expectation
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Visual Studio Code Flutter Format is Not Working with My ...
The Dart extension for VS Code uses the formatter from the Dart SDK (dart_style) which does not support customising the indent options (by ......
Read more >Debugging why flutter format did not work on visual studio code
I started getting error as “Extension 'Flutter' cannot format 'lib/body.dart'” here 'lib/body.dart' is file that I was trying to format.
Read more >Code formatting - Flutter documentation
Automatically formatting code in Android Studio and IntelliJ. Install the Dart plugin (see Editor setup) to get automatic formatting of code in Android...
Read more >Visual Studio Code - Dart
With the Dart plugin, you can use Visual Studio Code (VS Code) to develop Dart apps. The Flutter site has details on how...
Read more >VSCode Shortcuts, Extensions & Settings for Flutter ...
VSCode Extensions for Flutter Development · 1. Dart Data Class Generator · 2. Flutter Riverpod Snippets · 3. Error Lens · 4. Better...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The formatter for Dart is in the Dart extension (since it should work for non-Flutter users too), so if you’re setting the formatter explicitly for Dart you should set it to
Dart-Code.dart-code
.That said, this formatter can *only format Dart, so you shouldn’t set it as the default formatter for all lanuguages, as it will prevent you from being able to format other languages.
Unless you have good reason, you should be able to just delete that line from your settings - VS Code will use the Dart formatter for Dart files automatically without any specific configuration.
Let me know if this doesn’t seem to work for you. Thanks!
Thank You, this is working for me now!