Numan Ahmad
Numan Ahmad

Reputation: 1

pub get failed (78; Invalid `PUB_HOSTED_URL=" https://pub.flutter-io.cn"`: invalid url: Scheme not starting with alphabetic character)

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

  1. Create a new variable with the name: PUB_HOSTED_URL and assign value: https://pub.flutter-io.cn

  2. 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; Invalid PUB_HOSTED_URL=" https://pub.flutter-io.cn": invalid url: Scheme not starting with alphabetic character)

Upvotes: 0

Views: 1743

Answers (2)

Free Palestine
Free Palestine

Reputation: 2658

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

Upvotes: 0

MANISH DAYMA
MANISH DAYMA

Reputation: 1242

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"

Upvotes: 2

Related Questions