I created a new project and VS Code condenses any trailing commas unless line lengths are very long. This is a new behaviour. Have looked all over the internet, reinstalled, deleted cache files etc. No differences in any settings file at the user or workspace level. Both same versions of flutter and dart. Both same extensions (only flutter and dart). No difference in analyzer file... so I'm completely lost. Is this a new VS Code thing? It is very annoying as I'm trying to work on UI layouts and save condenses things to one line.
This behavior is caused by new Dart formatter introduced in Dart 3.7.
You can disable this by migrating to older version of Dart SDK by changing the pubspec.yaml
file to something like this:
environment:
# before
# sdk: ^3.7.0-267.0.dev
# after
sdk: '>=3.1.3 <4.0.0'
However, as stated in the changelog, 'old' formatter won't be here forever:
We don't intend to support both styles indefinitely. At some point in the future when most of the ecosystem is on 3.7 or later, support for the old style will be removed.