For those who are new to flutter development, some of the necessary potholes must be treaded. They will never be improved without treading potholes. Some of the potholes should be known in advance so that they can be avoided.
In order to warn future generations, this blog post will share about the failure of flutter packages get pits. Although this problem is very simple, some people still step on the pits. Here is the Mac system to do the example, Windows system is not introduced here.
Open a flutter project and keep Running “flutter packages get” in project_name… No matter how long you wait, it won’t make it to the wall.
The specific solution is as follows:
1. Open the Mac terminal and run the following command: open ~/. Bash_profile Press Enter to enter the bash_profile file.
2. Set the bash_profile file to editable mode;
3. Copy the following two lines of code and paste them to the corresponding positions, as shown in the figure:
export PUB_HOSTED_URL=pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=storage.flutter-io.cn
4, Paste, check, Esc key, then wq save the file, close the file;
Return to terminal, enter command line: flutter doctor press enter to see if there are any other configuration problems. If not, rerun the project directly.
6, run the project, there is no error or stuck, it runs very fast, very smooth.
The above is all the content of this chapter. Welcome to pay attention to the wechat public account of Sanzhan “iOS development by Sanzhan”, and the Sina Weibo account of Sanzhan “Sanzhan 666”, welcome to pay attention to it!