打开 flutter\packages\flutter_tools\lib\src\http_host_validator.dart 文件
修改:
const String kCloudHost = 'https://storage.googleapis.com/';
const String kCocoaPods = 'https://cocoapods.org/';
const String kGitHub = 'https://github.com/';
const String kMaven = 'https://maven.google.com/';
const String kPubDev = 'https://pub.dev/';
为:
const String kCloudHost = 'https://storage.flutter-io.cn/';
const String kCocoaPods = 'https://cocoapods.org/';
const String kGitHub = 'https://github.com/';
const String kMaven ='https://dl.google.com/dl/android/maven2/';
const String kPubDev ='https://pub.flutter-io.cn/';
删除 flutter\bin\cache\flutter_tools.snapshot 文件
重新打开cmd窗口,运行flutter doctor