今天,初学flutter的我在win10上新建一个flutter项目的时候,报了一个这样的错误:
D:\>flutter create demo
Recreating project D:\demo...
Because demo depends on cupertino_icons any which doesn't exist (could not find package cupertino_icons at https://storage.flutter-io.cn), version solving failed.
pub get failed (server unavailable) -- attempting retry 1 in 1 second...
Because demo depends on cupertino_icons any which doesn't exist (could not find package cupertino_icons at https://storage.flutter-io.cn), version solving failed.
pub get failed (server unavailable) -- attempting retry 2 in 2 seconds...
Because demo depends on cupertino_icons any which doesn't exist (could not find package cupertino_icons at https://storage.flutter-io.cn), version solving failed.
pub get failed (server unavailable) -- attempting retry 3 in 4 seconds...
Running "flutter pub get" in demo...
于是,我愤怒地在Github flutter上面开了一个issue,地址(顺便关注一下啊):
https://github.com/flutter/flutter/issues/52223
大神们很简短地给了2行代码,问题轻松解决!
setx PUB_HOSTED_URL "https://pub.flutter-io.cn"
setx FLUTTER_STORAGE_BASE_URL "https://storage.flutter-io.cn"
这是一段powershell代码,大伙们可以在vscode上的终端上运行,回车一按,问题轻松解决!