【问题标题】:What is meant by 'Sort pub dependencies'?“排序发布依赖项”是什么意思?
【发布时间】:2021-06-07 06:22:02
【问题描述】:

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

【问题讨论】:

    标签: flutter dart flutter-dependencies dart-null-safety


    【解决方案1】:

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

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

    linter:
     rules:
      - sort_pub_dependencies
    

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

    dependencies:
      markdown:
      archive:  # put archive before markdown
    

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

    【讨论】:

    • 按名称排序依赖项?
    【解决方案2】:

    这不是必要的规则,您可以通过转到您的 analysis_options.yaml 文件并在规则下添加此行来关闭它:

    sort_pub_dependencies: false
    

    【讨论】:

      猜你喜欢
      • 2018-04-10
      • 2011-08-05
      • 2019-04-23
      • 2016-03-17
      • 2016-11-28
      • 2022-11-07
      • 2019-03-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多