Dart-Code / Dart-Code

Dart and Flutter support for VS Code
https://dartcode.org/
MIT License
1.48k stars 300 forks source link

Auto sorting the dependencies in the pubspec.yaml #4009

Open TiffApps opened 2 years ago

TiffApps commented 2 years ago

Hi,

It would be great if the pubspec.yaml could automatically sort alphabetically the list of the dependencies when it's saved and/or when flutter pub get/add is runned. (get is probably always called after add, I don't know the details so I included it as a reminder in case it doesn't all the time)

Existing solutions:

DanTup commented 2 years ago

This requires the server first has an implementation of sorting the dependencies - likely via https://github.com/dart-lang/sdk/issues/47958. Then it should be automated either through the existing Fix All command (which can be run on save), or could be exposed as its own command (similar to Sort Members - or perhaps the same).

danchengash commented 1 year ago

There's a package to perfom the exact action on pub.dev https://pub.dev/packages/pubspec_dependency_sorter