Skip to content
pubscout

pubspec_dependency_sorter

1.0.5, released 2 years ago by an unverified publisher

Sorts pubspec.yaml dependencies alphabetically

$ flutter pub add pubspec_dependency_sorter
Source repository

What it does

Reorders dependencies, dev_dependencies, and other sections in a pubspec.yaml file to be alphabetically sorted. It can also prevent dependency conflicts by ensuring consistent ordering.

AI-written summary of version 1.0.5, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Managing large pubspec files with many dependencies
  • Collaborating in teams where consistent ordering is desired
  • Cleaning up a pubspec after adding or removing packages

Skip it when

  • You need advanced dependency resolution or conflict detection beyond sorting
  • You prefer a visual editor or GUI tool for pubspec management

Strengths

  • Simple command-line usage
  • No build_runner or code generation required
  • Works for both Flutter and pure Dart projects

Weaknesses

  • Does not resolve version conflicts, only sorts
  • Limited to alphabetical ordering, no custom grouping
  • No support for non-textual pubspec formats

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
3

Add as dev_dependency and run via `dart run pubspec_dependency_sorter`

```dart
// In pubspec.yaml

dev_dependencies:
  pubspec_dependency_sorter: ^1.0.5
```
```bash
dart run pubspec_dependency_sorter
```

Alternatives

Packages that do the same job and could replace pubspec_dependency_sorter.

  • yaml

    Provides low-level YAML manipulation but requires manual sorting logic

  • pubspec_parse

    Can parse pubspec but does not provide sorting functionality

Works with

Packages commonly used together with pubspec_dependency_sorter: ones it builds on, ones built on it, and its own family.