跳到主要內容

sort_pub_dependencies

依賴項未按字母順序排序。

描述

#

pubspec.yaml 檔案中依賴項對映的鍵未按字母順序排序時,分析器會產生此診斷。檢查的依賴項對映包括 dependenciesdev_dependenciesdependency_overrides 對映。

示例

#

以下程式碼會產生此診斷,因為 dependencies 對映中的條目未排序

yaml
dependencies:
  path: any
  collection: any

常見修復方法

#

排序條目

yaml
dependencies:
  collection: any
  path: any