Background: The Flutter has been upgraded to version 2.0, and the Web has entered a stable version with numerous bug fixes. First, switch the flutter to version 2.0, using the tools described above

Usage:

  1. Enabling Web Support

flutter config --enable-web

Output the log:

Setting enabl-web value to true You may need to restart any open editors for them to read the new Settings.Copy the code

Restart AndroidStudio

  1. Old project support requires the creation of a Web directory

flutter create .

This creates the Web directory under the project directory

  1. Run the application in the browser

// Run the Flutter in Google Chrome 4. Compile the flutter build Web

5. To deploy tomcat

  1. Start Tomcat and go to http://localhost:8080/

./startup.sh

The original plan was to convert some pages with simple configuration protocol rules into the form of Flutter Web in an app of the company, but it was not feasible. The product of Flutter Web is a complete application, and it is not possible to package every single page into an application.

For client developers, especially those involved in the development of Flutter, the transition to web project development can be made at no cost. With the existing Flutter project, the code remains 100% portable after eliminating android-specific features. With the exception of browser-specific properties such as mouse hover, there is little difference between the two, so don’t worry too much about adaptation.

Since a large part of the web side is drawn by canvas, it is easy to face performance problems when the screen needs to be redrawn frequently, such as zooming. Since There is no developer tool for Flutter Web itself, Chrome’s own tools cannot accurately find the key elements, which makes it difficult to develop and debug.