Flutter, a cross platform app development framework


Flutter practice

The complete closed loop of digital plus product line has a user oriented app end. Since the company has no native app development, it chooses cross platform technology for development, and the task is naturally handed over to the front end.

Technology selection

Because everyone has no experience in app development, technology selection is particularly important. In line with the principle of using the new instead of the old, the technical team has a strong interest in the extremely new thing of flutter. After a series of research and comparison with react native, the following are the differences.

Basic characteristics RN flutter
language JS Dart
Rendering mechanism Calling native UI rendering interface through JS code is a bit slower, and UI unity can not be completely unified, so it can only sacrifice part of the design With its own UI system, the framework can interact directly with the lower level of skii, which is theoretically more efficient and can ensure consistent performance on different platforms
ecology There are a lot of open source components and mature solutions At the beginning, there are some high-quality open-source components, but not many
Difficulty of getting started simple For front-end engineers, they need to learn another language, and the layout method is quite different from CSS, so it is difficult to get started

Through the above analysis, we can know that as a new framework, the underlying mechanism of flutter is better than RN, but it is in its infancy, and it is not as good as RN ecologically. Again, with the curiosity of programmers about unknown things, we all choose flutter.

Project construction

If you have a passion for new things, you must be prepared for mining. When you build a project, problems emerge in endlessly. The cocoapods on the IOS end didn’t come down for a whole day, and the final solution is to try several more times… Next, you can use the Android emulator console to report errors constantly, because you can’t use the latest Android Q version. It’s reasonable that the original flutter has thousands of issues on GitHub. Despite the difficulties, it took a week to build the project, and Google gave developers a way to live.

Coding experience

On the basis of reading through dart documents and the flutter tutorial, I thought that we could quickly and efficiently code according to the speed of Zhihu’s two-hour development. However, I had no idea how to start with the UI design drawing, so I had no choice but to read the documents and read the technical blog, which showed me the speed of development I can’t bear to look directly at it.

  1. The first difficulty is that the layout rules of flutter have been greatly changed. We need to understand many new concepts. Overflow, stacking and boundary constraints are all different from CSS. Take the overflow as an example. CSS overflow is a natural overflow. The style of parent element determines the overflow performance of child element. When it comes to flutter, it is a direct error report! Yes, you are right. Overflow is not allowed at all. You should first consider whether the content is too long to use different boxes. Not to mention a bunch of concepts, such as length width auto scaling, alignment, full width boxes in case of stacking, and so on. Now I think of them as one end bags.
  2. Another typical example is that flutter is also a component-based concept, state control view. However, poor communication between components through classes is really troublesome, far less simple and intuitive than react or Vue.
  3. The design of various basic widgets is complicated, and some of them are very difficult to use. Up to now, I still don’t understand how the builder mode of listview works.

Package deployment

I thought that the problems encountered in the construction of the project should reappear in the deployment, but the actual packaging process is surprisingly smooth. Only when the IOS package is printed, it seems a little lengthy due to the security of the platform, and there are basically no other problems. I can successfully run the release package on the two terminal real machine, and the project development is finally relieved.

Advantages of flutter

Although the coding experience is very bad for the front-end programmers, I have to say that this bad experience is based on the premise of fast starting. With in-depth understanding and a lot of code experience, I believe it can also enable the flutter engineers to develop efficiently. Flutter also has many undeniable flash points. In the release environment, speed and fluency have a very good experience, and after the whole project is completed, there is almost no inconsistency in the performance of dual end UI. Google’s promise has been achieved, and there is no need to make special compatibility for the platform. For the front-end engineers who have been poisoned by ie before, it is undoubtedly happy.

The above is the practical experience of the development of flutter. Generally speaking, flutter is an excellent framework, and its performance and UI performance are worthy of recognition. However, I hope Google can take care of the developers more. Everyone’s time is very precious. For a framework, ease of use is also a very important factor.

Recommended Today

DK7 switch’s support for string

Before JDK7, switch can only support byte, short, char, int or their corresponding encapsulation classes and enum types. After JDK7, switch supports string type. In the switch statement, the value of the expression cannot be null, otherwise NullPointerException will be thrown at runtime. Null cannot be used in the case clause, otherwise compilation errors will […]