What is meant by 'Sort pub dependencies'?

4,776

Solution 1

sort_pub_dependencies is a lint that comes from the Dart linter: https://dart-lang.github.io/linter/lints/sort_pub_dependencies.html

The lint is activated in the analysis_options.yaml file in your project.

linter:
 rules:
  - sort_pub_dependencies

Basically, it is telling you to sort the name of the dependencies alphabetically in the pubspec.yaml

dependencies:
  markdown:
  archive:  # put archive before markdown

You can remove the line from analysis_options.yaml if you don't want to enforce this rule.

Solution 2

It isn't a necessary rule, you can just turn that off by going to your analysis_options.yaml file and adding this line under rules:

sort_pub_dependencies: false
Share:
4,776
Vaishnavi Sood
Author by

Vaishnavi Sood

Updated on December 28, 2022

Comments

  • Vaishnavi Sood
    Vaishnavi Sood over 1 year

    I am trying to migrate a project into null safety mode,after migrating and clearing all the errors, I am getting this problem named 'Sort pub dependencies.dart(sort_pub_dependencies)'. I searched Google but couldn't find any solution. Any help would really be appreciated :)

  • Syed Ali Raza Bokhari
    Syed Ali Raza Bokhari about 3 years
    Sort dependencies by name?