After the release of Flutter 2.0, the Web version entered the Stable branch. The Desktop version can also be previewed in the Stable branch through the Snapshot beta image. As a result, the topic about “Flutter rules the whole platform” has been hyped recently. Therefore, this article will mainly provide an answer to this topic.
1. Flutter rules the whole platform
“Every application can be update-free with Flutter 2 because they can now scale to Desktop and the Web without being rewritten,” Google said in its official release of Flutter 2.0.
The truth is that Flutter works well on Android and iOS, but not so well on the Web and Desktop at the moment. Google may not believe that “no extensions should be rewritten”.
First of all, it is unrealistic to “extend to Desktop and Web without rewriting”. Why we will analyze this later? Here is the core design of Flutter.
The platform just needs to be providedSufrace
Engine interacts directly with the GPU. The controls are also platform-independent, so Flutter has good performance and cross-platform capabilities.
1.1、 Web
However, Flutter on the Web is not exactly as described above. Because the JS/CSS/HTML hegemony of browsers on the Web is unshakeable, Flutter is initially converted to the browser’s native tags on the Web via the HtmlCanvas.
What’s wrong with that? This means that Flutter needs to be “coupled to a different degree to the Web native”. This causes code to behave differently on different platforms and apis. Flutter responds to this situation by using a large number of custom tags. As a result, the size, performance and experience are not very good.
Flutter also provides another Web rendering capability that is closer to Mobile and Desktop’s CanvasKit rendering mode. CanvasKit is equivalent to WebGL’s VERSION of Skia rendering. Performance is definitely better in this mode. But the workload of compatibility and adaptation that needs to be done is also larger.
Flutter web compilation can be done using –web-renderer to specify the rendering mode. Now the mode is auto mode, i.e. using the HTML renderer in the mobile browser and using the CanvasKit renderer in the PC browser.
This is not to belittle the Web, but to express that Flutter Web is not and cannot kill front-end development, nor can it challenge React and Vue. It is more an expansion of Flutter capabilities:
Flutter developers happen to have written an App or Desktop page, so they can package it as a Web page and use it. While the experience is bad, it is not impossible to use the scenario.
Therefore, at least for a short time, Flutter Web is the “younger brother” in the front-end domain, not to mention a bully.
1.2, the Desktop
Flutter is ok on PC because it has similar rendering logic to mobile. The main test of Flutter on PC is the control experience and plugin support.
That most of the time because, unlike mobile phone, the PC interface layout and mobile terminal itself is put in bigger difference, even the Desktop interface is usually can adjust the size, in addition the Desktop application focus mainly comes from the mouse input and control, so a return to the front of the words “without rewriting the extension to the Desktop and Web” is not realistic.
So is there a way to make the interface work on both PC and Mobile? Yes, the ResponsiveFramework is used to implement this requirement, of course, with performance and time costs.
In addition, there are still some common scenarios between PC and Mobile, such as the application of type 2B products like flying book series. In terms of the functions and that of small programs, the same logic can be achieved in the simultaneous release of Mobile phones and PCS more efficiently, and may also have good performance.
Finally, Flutter also added a desktop experience to ReorderableListView, TextField, and TextFormField controls in 2.0. But again, Flutter has just begun to make its way into the PC world. Hegemony is impossible, but the future is definitely clearer on PC than it is on the Web.
- A major contributor to the Electron packaging scheme, squirrel-flutter was created
- Ubuntu installer uses Flutter
- Microsoft is continuing to expand Flutter support Announcing Flutter Support for Foldable Devices
Experienced multi-terminal development to understand how high the cost of a set of code in multi-terminal general, cross-platform to Android and iOS high performance low coupling implementation has been difficult to get, if you want to seamlessly expand to the Web and Desktop will only dig their own holes, so part of the logic of the whole platform, The actual project sub-platform I think is the future of Flutter multi-platform.