“排序 pub 依赖项”是什么意思?

Vai*_*ood 6 dart flutter flutter-dependencies dart-null-safety

我正在尝试将项目迁移到空安全模式,在迁移并清除所有错误后,我遇到了名为“ Sort pub dependencies.dart(sort_pub_dependencies) ”的问题。我搜索了谷歌,但找不到任何解决方案。任何帮助将不胜感激:)

Xav*_*ier 13

sort_pub_dependencies是来自 Dart linter 的 lint:https : //dart-lang.github.io/linter/lints/sort_pub_dependencies.html

lintanalysis_options.yaml在您项目的文件中被激活。

linter:
 rules:
  - sort_pub_dependencies
Run Code Online (Sandbox Code Playgroud)

基本上,它告诉您在依赖项的名称中按字母顺序排序 pubspec.yaml

dependencies:
  markdown:
  archive:  # put archive before markdown
Run Code Online (Sandbox Code Playgroud)

analysis_options.yaml如果您不想强制执行此规则,则可以删除该行。

  • 按名称对依赖项进行排序? (3认同)