Got socket error trying to find package cupertino_icons at https://pub.dartlang.org

Viewed 8657

Whenever i try to create a new project in flutter through git bash or command prompt, i keep on getting this error Got socket error trying to find package cupertino_icons at https://pub.dartlang.org. I have upgraded the flutter sdk to the latest version but still the same problem. Please how do i solve this issue. Thanks

6 Answers

I would advice anyone that might still be having this problem to TRY the following simply steps:

  1. open environment variable settings
  2. create a new variable with the name: PUB_HOSTED_URL and its value: https://pub.flutter-io.cn
  3. create a new variable with the name: FLUTTER_STORAGE_BASE_URL and its value: https://storage.flutter-io.cn

This did it for me. After spending weeks tryna figure it out. Would love to save someone the headache i went through.

Spent 2 hours on it myself, in addition to the previous settings, check your antivirus, mine automatically blocked flutter, so disable your antivirus completely it and then try running again, hope this helps someone.

On Linux, this worked for me and for many other people... It should work for you too.

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

On windows, you should create an environment variable with:

name: PUB_HOSTED_URL
 
value: https://pub.flutter-io.cn

name: FLUTTER_STORAGE_BASE_URL

value: https://storage.flutter-io.cn

I have found that resetting your wifi router works. It's happened to me twice and it worked after I reset my router.

Using a VPN for access to the internet did the trick for me.

Related