flutter - dart/flutter pub 的 credentials.json 的新位置是什么

标签 flutter dart dart-pub

我注意到切换到 beta channel (Flutter 2.9.0-0.1.pre)后,~/.pub-cache/credentials.json 不再存在。我正在使用这个文件来设置 CI 作业来部署我的 Flutter 包。去哪儿了?

最佳答案

看起来它已移至以下位置:

On Linux:

  • If $XDG_CONFIG_HOME is defined:
    • $XDG_CONFIG_HOME/dart/pub-credentials.json
  • else
    • $HOME/.config/dart/pub-credentials.json

On Mac OS:

  • ~/Library/Application Support/dart/pub-credentials.json

On Windows:

  • %APPDATA%/dart/pub-credentials.json

(来源:dart-lang/pub#2999 - Do not store credentials in PUB_CACHE)

(相关代码:https://github.com/dart-lang/cli_util/blob/master/lib/cli_util.dart#L88)


在 GitHub Actions 上,$XDG_CONFIG_HOME 已定义,因此我执行以下操作:

- name: Prepare pub credentials
  run: echo '${{ secrets.PUB_CREDENTIALS }}' > "$XDG_CONFIG_HOME/dart/pub-credentials.json"

关于flutter - dart/flutter pub 的 credentials.json 的新位置是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70487479/

相关文章:

flutter - 如何在 TableRow 中为 Flutter Table 设置表格列大小

dart - flutter 中的 ListView

ios - 我应该为 Flutter 插件传入我的 Swift native 代码中的哪个 View Controller ?

firebase - 检查firebase记录是否存在并返回 bool 值

dart - 装饰图像不被BoxDecoration剪切

flutter - Flutter-Navigator.push值列出

Flutter:如何在textformfield上没有输入时隐藏后缀图标?

Flutter 默认图像占位符

flutter - Dart 包版本如何工作以及我应该如何版本我的 Flutter 插件?

dart - 在 Dart 和 Pub 中,我应该将 pubspec.lock 添加到我的 .gitignore 中吗?