Using Flutter in China

To speed the download and installation of Flutter in China, consider using a mirror site or mirror.

Use a Flutter mirror site

#

The China Flutter User Group (CFUG) maintains a Simplified Chinese Flutter website https://flutter.cn and a mirror. Other mirrors can be found at the end of this guide.

Configure your machine to use a mirror site

#

To install or use Flutter in China, use a trustworthy Flutter mirror. This requires setting two environment variables on your machine.

All examples that follow presume that you are using the CFUG mirror.

To set your machine to use a mirror site:

Download Flutter archives based on a mirror site

#

To download Flutter from the SDK archive from a mirror, replace storage.googleapis.com with the URL of your trusted mirror. Use your mirror site in the browser or in other applications like IDM or Thunder. This should improve download speed.

The following example shows how to change the URL for Flutter's download site from Google's archive to CFUG's mirror.

Configure your machine to publish your package

#

To publish your packages to pub.dev, you need to be able to access both Google Auth and the pub.dev site.

To enable access to pub.dev:

  1. Configure a proxy. To configure a proxy, check out the Dart documentation on proxies.

  2. Verify that your PUB_HOSTED_URL environment variable is either unset or empty.

     echo $env:PUB_HOSTED_URL

    If this command returns any value, unset it.

     Remove-Item $env:PUB_HOSTED_URL
  1. Configure a proxy. To configure a proxy, check out the Dart documentation on proxies.

  2. Verify that your PUB_HOSTED_URL environment variable is either unset or empty.

     echo $PUB_HOSTED_URL

    If this command returns any value, unset it.

     unset $PUB_HOSTED_URL
  1. Configure a proxy. To configure a proxy, check out the Dart documentation on proxies.

  2. Verify that your PUB_HOSTED_URL environment variable is either unset or empty.

     echo $PUB_HOSTED_URL

    If this command returns any value, unset it.

     unset $PUB_HOSTED_URL
  1. Configure a proxy. To configure a proxy, check out the Dart documentation on proxies.

  2. Verify that your PUB_HOSTED_URL environment variable is either unset or empty.

     echo $PUB_HOSTED_URL

    If this command returns any value, unset it.

     unset $PUB_HOSTED_URL

To learn more about publishing packages, check out the Dart documentation on publishing packages.

Known, trusted community-run mirror sites

#

The Flutter team can't guarantee long-term availability of any mirrors. You can use other mirrors if they become available.


China Flutter User Group

#

China Flutter User Group maintains the flutter-io.cn mirror. It includes the Flutter SDK and pub packages.

Configure your machine to use this mirror

#

To set your machine to use this mirror, use these commands.

On macOS, Linux, or ChromeOS:

export PUB_HOSTED_URL=https://pub.flutter-io.cn;
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

On Windows:

$env:PUB_HOSTED_URL="https://pub.flutter-io.cn";
$env:FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"

Get support for this mirror

#

If you're running into issues that only occur when using the flutter-io.cn mirror, report the issue to their issue tracker.


Shanghai Jiao Tong University *nix User Group

#

Shanghai Jiao Tong University *nix User Group maintains the mirror.sjtu.edu.cn mirror. It includes the Flutter SDK and pub packages.

Configure your machine to use this mirror

#

To set your machine to use this mirror, use these commands.

On macOS, Linux, or ChromeOS:

export PUB_HOSTED_URL=https://mirror.sjtu.edu.cn/dart-pub;
export FLUTTER_STORAGE_BASE_URL=https://mirror.sjtu.edu.cn

On Windows:

$env:PUB_HOSTED_URL="https://mirror.sjtu.edu.cn/dart-pub";
$env:FLUTTER_STORAGE_BASE_URL="https://mirror.sjtu.edu.cn"

Get support for this mirror

#

If you're running into issues that only occur when using the mirror.sjtu.edu.cn mirror, report the issue to their issue tracker.


Tsinghua University TUNA Association

#

Tsinghua University TUNA Association maintains the mirrors.tuna.tsinghua.edu.cn mirror. It includes the Flutter SDK and pub packages.

Configure your machine to use this mirror

#

To set your machine to use this mirror, use these commands.

On macOS, Linux, or ChromeOS:

export PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub;
export FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/flutter

On Windows:

$env:PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub";
$env:FLUTTER_STORAGE_BASE_URL="https://mirrors.tuna.tsinghua.edu.cn/flutter"

Get support for this mirror

#

If you're running into issues that only occur when using the mirrors.tuna.tsinghua.edu.cn mirror, report the issue to their issue tracker.

Offer to host a new mirror site

#

If you're interested in setting up your own mirror, contact flutter-dev@googlegroups.com for assistance.