Flutter web environment construction

In the domestic environment, it took a lot of effort to build the Flutter web environment. The following is a detailed explanation of the build process.

Step 1: Download the beta version

https://flutter.cn/docs/development/tools/sdk/releases  Find the latest version of the beta channel in the version list. I use 1.22.0-12.1.pre here. About 700MB. Unzip it to the installation directory, it is recommended to put it in C:/src/flutter

The second step:

Set Path environment variable C:/src/flutter/bin

Set dart_pub, flutter environment variables (the domestic environment needs to use mirroring, see the reference link below for details)

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

Step 3: Set up support web: flutter config --enable-web

Step 4: Run cmd: flutter docter, install related tools as required, such as visual studio code.

Step 5: Run cmd: flutter devices, here should output a web device information called chrome etc.

第六步: flutter create myapp && cd myapp && flutter run -d chrome

 

There may be an error message here:  NoSuchMethodError: The method'toFilePath' was called on null. This is a flutter bug, waiting to be updated

Reference link:

https://flutter.cn/docs/get-started/web

https://flutter.cn/community/china

https://dart.cn/samples

Guess you like

Origin blog.csdn.net/u013475983/article/details/108729555