4

I noticed that after switching to the beta channel (Flutter 2.9.0-0.1.pre), ~/.pub-cache/credentials.json no longer exists. I was using this file to set up CI jobs to deploy my Flutter packages. Where did it go?

xip
  • 2,475
  • 3
  • 18
  • 24

1 Answers1

9

Looks like it was moved to the following locations:

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

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

(Relevant code: https://github.com/dart-lang/cli_util/blob/master/lib/cli_util.dart#L88)


On GitHub Actions, $XDG_CONFIG_HOME was defined, so I do the following:

- name: Prepare pub credentials
  run: echo '${{ secrets.PUB_CREDENTIALS }}' > "$XDG_CONFIG_HOME/dart/pub-credentials.json"
xip
  • 2,475
  • 3
  • 18
  • 24
  • /home/runner/.config/dart/pub-credentials.json: No such file or directory issue can be fixed with `run: mkdir -p $XDG_CONFIG_HOME/dart && echo '${{ secrets.PUB_CREDENTIALS }}' > "$XDG_CONFIG_HOME/dart/pub-credentials.json"` – MJ Studio Oct 23 '22 at 08:34
  • seems confusing, if you want to view the json file in window, goto "C:\Users\\AppData\Roaming\dart\pub-credentials.json". Note: make sure you login with "dart pub publish" first – Kunchok Tashi Nov 29 '22 at 09:07