• Using Flutter in China
  • Original author: Flutter
  • The Nuggets translation Project
  • Permanent link to this article: github.com/xitu/gold-m…
  • Translator: mysterytony
  • Proofread by hanliuxin5, Starriers

Flutter is used in China

If you install or use Flutter in China, you can use a trusted local image to host Flutter dependencies. To enable Flutter to use an alternate online access address, you need to set two environment variables before running the Flutter directive: PUB_HOSTED_URL and FLUTTER_STORAGE_BASE_URL.

For example, on MacOS or Linux, here are the first steps you need to set up to enable you to use a mirror site. Run the following Bash command in the Flutter folder where you want to store the clone:

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
git clone -b dev https://github.com/flutter/flutter.git
export PATH="$PWD/flutter/bin:$PATH"
cd ./flutter
flutter doctor
Copy the code

You should then be able to continue to configure Flutter normally. From now on, packages downloaded with flutter Packages GET on the console with PUB_HOSTED_URL and FLUTTER_STORAGE_BASE_URL environment variables will be downloaded from flutter-io.cn.

The flutter io.cn server is a temporary mirror of the dependencies and packages of Flutter maintained by GDG China. The Flutter team cannot guarantee the long-term availability of this service. You are free to use any other images available. If you are interested in setting up your own mirror image in China, please contact [email protected] for assistance.

Known issues:

  • Resources needed to run the Flutter Gallery application from source are currently hosted in domains that are not currently supported by this solution. You can subscribe for updates on this issue. You can also check out Flutter Gallery on Google Play or in a third-party store you trust.

The Nuggets Translation Project is a community that translates quality Internet technical articles from English sharing articles on nuggets. The content covers Android, iOS, front-end, back-end, blockchain, products, design, artificial intelligence and other fields. If you want to see more high-quality translation, please continue to pay attention to the Translation plan of Digging Gold, the official Weibo, Zhihu column.