At the start I was getting an error:
Got socket error trying to find package flutter_lints at https://pub.dartlang.org.
I tried a solution that create a new environment variable
Create a new variable with the name:
PUB_HOSTED_URL
and assign value:https://pub.flutter-io.cn
Create a new variable with the name:
FLUTTER_STORAGE_BASE_URL
and assign value:https://storage.flutter-io.cn
It does not work, now I am getting new error:
Invalid
PUB_HOSTED_URL=" https://pub.flutter-io.cn"
: invalid url: Scheme not starting with alphabetic character Running "flutter pub get" in my_card... pub get failed (78; InvalidPUB_HOSTED_URL=" https://pub.flutter-io.cn"
: invalid url: Scheme not starting with alphabetic character)
CodePudding user response:
There is a space at first PUB_HOSTED_URL=" https://pub.flutter-io.cn"
Change this to PUB_HOSTED_URL="https://pub.flutter-io.cn"
CodePudding user response:
Set variable without any quotation marks like this: in terminal type:
set PUB_HOSTED_URL=https://pub.dartlang.org
to make sure it is set, use echo:
echo %PUB_HOSTED_URL%
then run flutter pub get
If this solution doesn't work, then
go to environment variables of windows,
in user variables,
edit PUB_HOSTED_URL
to the correct url without any quotation marks .
Then restart Android Studio