secure_pubspec_urls
在 pubspec.yaml
中使用安全的 URL。
此規則自 Dart 2.16 起可用。
詳細資料
#請務必在 pubspec.yaml
中使用安全的 URL。
請使用 https
,而不是 http
或 git:
。
錯誤範例
yaml
repository: http://github.com/dart-lang/example
yaml
git:
url: git://github.com/dart-lang/example/example.git
正確範例
yaml
repository: https://github.com/dart-lang/example
用法
#若要啟用 secure_pubspec_urls
規則,請在您的 analysis_options.yaml
檔案中的 linter > rules 下方新增 secure_pubspec_urls
analysis_options.yaml
yaml
linter:
rules:
- secure_pubspec_urls
除非另有說明,否則本網站上的文件反映的是 Dart 3.6.0。頁面最後更新時間為 2024-07-03。 檢視原始碼或回報問題。