[Solved] Flutter switch sources and set environmental variables

2022/07/30 21:54

If the official Flutter source is too slow, you can switch the official source to some other sources.

Just copy the following command to your Terminal.

vim ~/.bash_profile

//open bash profile in vim editor

export PUB_HOSTED_URL=https://pub.flutter-io.cn

export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

export PATH=/Users/your user name/flutter_dev/flutter/bin:$PATH

If you are using zsh

1 Open .zshrc in vim editor by inputting the following code
vim $HOME/.zshrc
2 set environmental variable
export PATH=$PATH:/Users/dandan/flutter/bin:$PATH
3 press ESC button on your keyboard and type wq! in your vim editor
4 type ‘source .zshrc’ in your Terminal

Leave a Reply

Back to top