跳到主要內容

secure_pubspec_urls

不應使用 '{0}' 協議,因為它不安全。

描述

#

pubspec.yaml 檔案中的 URL 使用不安全的方案(例如 http)時,分析器會生成此診斷資訊。

示例

#

以下程式碼會生成此診斷資訊,因為 pubspec.yaml 檔案包含 http URL

yaml
dependencies:
  example: any
    repository: http://github.com/dart-lang/example

常見修復方法

#

將 URL 的方案更改為使用安全的方案,例如 https

yaml
dependencies:
  example: any
    repository: https://github.com/dart-lang/example