
{
"editor.fontSize": 13.5,
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "Dart-Code.flutter"
}

"editor.defaultFormatter": "Dart-Code.flutter"
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!
@DanTup Thanks for the reply! But It doesn't work for me.
@DanTup I figured it out. I should add , after LinearGradient()!
Sorry, it seems like there were two issues described and I only covered the first. The initial error saying Flutter can't format was for the reason I gave above. Trailing commas are the correct way to force the specific formatting you wanted - there's a little more info about this on the Flutter website here:
https://flutter.dev/docs/development/tools/formatting#using-trailing-commas
"editor.defaultFormatter": "Dart-Code.flutter"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!
Most helpful comment
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!