跳到主要内容

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