Flutter 2.0 was released this morning. Web development is now supported in Stable Channel. Very excited!

Update description for Flutter 2.0

  • Release notes — 2.0.0
  • What’s New in Flutter 2
  • Flutter release 2.0 | for Web, mobile and desktop client to build the next generation of Flutter

Due to my particularity, THERE are multiple requirements for Flutter. Such as:

  • Hybrid development, required in the 1.17.5 version of Flutter
  • Older versions of Web development need to be developed under the beta channel
  • The pure Flutter project follows stable Channel

In order to be able to develop in various projects, I needed to quickly switch the Flutter environment. So I used the FVM tool.

If you don’t know how to use FVM, you can refer directly to the project’s usage documentation, or refer to the previous article: FVM happily switches to the Flutter version, highly recommended!

If you are an experienced user of FVM, you can ignore the following.

In actual combat

Suppose that before Flutter 2.0, there was a FLt_demo project:

  • Using FVM
  • The version of a Flutter is specified as stable

Create a Web project based on the latest Stable Channel

Create a new project, web_demo, that requires Flutter 2.0 for web development:

$ mkdir web_demo
$ cd web_demo
$ fvm use stable --force 
$ fvm flutter create .
$ fvm flutter doctor
Copy the code

We ended up with Flutter version 1.22.6.

Need to update to the latest stable version:

$ fvm flutter upgrade
$ fvm flutter doctor
Copy the code

πŸ‘ŒπŸ», the Flutter environment for web_demo is complete and can be played happily.

Save the fltDemo project based on the old stable Channel

Since FLt_demo was also developed in Stable Channel, some errors were reported when we re-ran the project (some APIS were deprecated, some third-party libraries reported errors).

The existing stable channel is Flutter 2.0, but for FLt_demo, Flutter 2.0 does not work. So we need the old version of stable environment.

To obtain the published version of flutter, run the following command:

$ fvm releases
Copy the code

The older stable Channel corresponds to version 1.22.6.

Therefore, we need to modify fltDemo’s FLUTTER environment to 1.22.6.

$ cdFlt_demo $FVM install 1.22.6 $FVM use 1.22.6 --force $FVM flutter doctorCopy the code

πŸ‘ŒπŸ», complete the flutter environment assignment of FLt_demo.

If FLT_demo is a team project, submit your changes. Colleagues pull the code and execute it in the project root path

$ fvm install
Copy the code

Can.

It’s time to get back to the fun.

Flutter2.0 for the Web, has now completed a blog site:

  • Source: swiftdo/web – demo
  • Site: webdemo. Loveli. Site
  • Article: Flutter2 for Web, wrote a blog site and went live

For more dry goods, please pay attention to OldBirds, the official wechat account