Is Xianyu quietly giving up Flutter?

Xianyu introduced Flutter in 2017. At that time, Flutter was far from mature, and there was no precedent in the industry to put Flutter into the existing engineering system for development.

Since then, the Xianyu team of less than 15 people has made some innovations in engineering architecture, hybrid stack calling, packaging construction, and collaboration mode, ensuring that Flutter can be integrated into Xianyu's existing client engineering system. During the period from 2017 to 2019, Xianyu also continuously corrected bugs to improve the stability of Flutter and synchronized it to Google. In practice, it precipitated a set of its own hybrid technology solutions and open sourced the Flutter Boost engine.

In 2019, Xianyu began to land on a large scale to promote the application of Flutter in Xianyu. In 2020, the main link of Xianyu Online has almost completely embraced Flutter. In the past two years, Flutter has gradually landed in other companies, but at the same time, there are constantly voices of doubt. There are even rumors that "Xianyu's new business has given up Flutter", "I believe that Xianyu has encountered a big problem"...

So, as a pioneer and pathfinder of Flutter, has Xianyu made a detour in the process of exploration in the past few years? What kind of challenges does Xianyu face now? Will Flutter be abandoned? What technology did the new business choose? What are the corresponding technical selection principles? In response to these questions, Yu Jia (Zong Xin), the client in charge of the Xianyu technical team, gave us the answers one by one.

The first domestic team to introduce Flutter

InfoQ: What problem did Xianyu mainly solve when introducing Flutter?

Yu Jia (Zong Xin): When Xianyu researched in 2017, the client team had less than 15 people, and Xianyu's business scenario can be called a "little Taobao", which is relatively complex. In this scenario, the first thing we need to solve is the problem of multi-terminal manpower sharing. The benefits of multi-end manpower not only allow one person to develop two ends, but also represent better R&D resource allocation flexibility (this means that the team's iOS:Android ratio no longer needs to be 1:1, while the Android engineer base on the market) much larger than iOS).

In addition, we hope that this technology fits the mobile R&D technology stack, not the front-end technology stack. For RN and Weex, the tool chain and R&D habits are quite different. Finally, we hope that the experience of this technology can be close to the native one. Flutter under AOT basically meets our requirements at the time. In the actual test process, the performance of Flutter on low-end machines is better than that of Native. Therefore, Flutter was selected based on these three conditions.

During the trial investment in 2018, the entire infrastructure and exploration brought a certain cost. In 2019, the team began to officially use Flutter for research and development. At present, 70% of the commits of the entire team come from Dart, which can be said to have basically fulfilled our original expectations. In the actual R&D process, it is basically possible to accomplish a goal that requires input from one client.

InfoQ: Many people question the Dart language, thinking that this language is unique and niche, and there are still problems such as multi-level nesting. What do you think of the application of the new language?

Yu Jia (Zong Xin): Language is one of the factors in our selection of technical solutions, but it is a relatively weak factor.

We will look at it from several angles:

The background of the language, from our point of view, Dart is developed by a large factory and has a long history.

The cost of language learning, from the point of view of syntactic sugar and learning curve, Dart cost is relatively low, first of all, Android students are very quick to get started. In addition, iOS students who are familiar with swift can get started quickly. Many features of modern languages ​​are in common. This part is its strength.
Other advantages brought by the language, such as AOT and JIT support for compiled products, are more flexible. AOT has clear performance advantages.

The future of language. Dart's ranking of Github Pull Requests in the fourth quarter of 2020 has reached the 13th place on the entire network, surpassing Kotlin (15th), Swift (16th), and Objective-C (18th). As a new language in the field of mobile technology, the growth is still very good.

For problems like multi-level nesting, which can be solved by further abstracting some control classes or methods, it is not a particularly big problem.

InfoQ: What key innovations did Xianyu make after introducing Flutter? What are the benefits of using Flutter?

Yu Jia (Zong Xin): Xianyu has a lot of innovation in this part, and has applied for a lot of patents internally.

Our open source project, Flutter Boost, revolutionized some of the official Flutter RoadMaps. At present, Add2ExistApp is the most mainstream R&D method in the industry. On the one hand, hybrid development helps the business to migrate to the new technology stack more smoothly, and on the other hand, it can make better use of the existing native capabilities and greatly reduce the repetitive development work.
The external texture solution for audio and video is also a common solution for major manufacturers in the industry. Under the external texture solution, the cache management on the Native and Flutter sides has been unified, and the performance has also been improved to a certain extent.

Flutter APM, a performance stability data collection and processing solution based on the Flutter technology stack, is currently co-constructed with multiple BUs within the group to provide services for large AliFlutter organizations.

The Flutter-related dynamic template solution, Flutter DX, is compatible with the Group's existing Native templates, which ensures smooth business migration and provides some business dynamics for Flutter.
There are many others, including the internal high-performance long list container PowerScrollView, the animation framework Fish-Lottie, and the game engine Candy. We still have some new directions in the process of precipitation, and we have also invested in the R&D process and R&D tools based on Flutter. In the future If you are interested, you can go to the industry conference organized by InfoQ to communicate with us.

Has Xianyu ever thought about giving up Flutter?

InfoQ: In the past year or two, what is the biggest challenge you have encountered in Flutter development? Was it the same challenges as when using Flutter in the first place?

Yu Jia (Zong Xin): In the past few years, Xianyu was the pioneer of the entire industry. The main challenge was that the entire technical ecology was too poor, and it had to be done by itself. In addition, there is a big problem with the stability of the engine in the early stage.

In recent years, with the in-depth use of the entire technology and the rapid development of Xianyu's business in the past two years, more and more experience problems have been mentioned by everyone. Therefore, we have carried out a major revision of the entire product since last year. At the same time, the client's The goal is to fully optimize and create a better user-end product experience.

Therefore, after the ecology is gradually improved, our challenge is how to achieve a more refined user experience through Flutter. Last year, this part really took a lot of our energy. Based on this proposition, we have also developed more Flutter-based detection tools for memory and stuttering, and there are some more specific methods for memory optimization and stuttering optimization, but I have to say that all detailed optimizations are It is more labor-intensive, whether it is Native or Flutter, we have to invest a lot of energy, so we are currently recruiting clients for the whole industry. I hope that students who are interested in exploring in the field of Flutter can contact me.

InfoQ: Under the hybrid R&D system, Xianyu has also customized the engine, so what are the main problems of the official solution? For the average small business, will the complexity of hybrid development be too high?

Yu Jia (Zong Xin): Xianyu had a lot of actions to modify the engine in the early stage. I have some reflections on it at that time. On the one hand, it was indeed because Flutter was not perfect. The understanding is not deep enough. In many cases, it can be solved through higher-level solutions, which indirectly makes it difficult for many of our engine customization modifications to be integrated into the backbone.

So what I want to say in this part is that the current official solution can solve 90% of the problems. If you have to talk about customization, there are still some problems on the performance side. For example, Xianyu currently does not use Flutter on its homepage or native, because the startup and loading experience is not good after the replacement. In addition, people have been criticizing the lag problem on the long list side. We have tried to solve part of it through the upper framework, and then the bottom layer may be needed. The engine helps optimize. In addition, some problems including inconsistent double-ended fonts and inconsistent input box experience require long-term optimization by the official.

At present, we mainly hope to follow the main branch and try not to modify the code of Flutter. The Xianyu team will reserve some experts on the engine side, and will also rely on the ecology of the group AliFlutter to do things. In the entire AliFlutter organization, different BUs are good at different things. For example, UC students are better at engine customization, the Xianyu team has a large number of upper-level application frameworks, and the Taobao team provides related infrastructure based on construction. In this way, most of the problems can be solved by the internal open source community in large companies, and development can be done with confidence.

For small and medium-sized enterprises, it is necessary to clarify the scenarios that everyone faces. If the early iterations run quickly, there can be some compromises on the details. Choosing Flutter is a relatively clear path. The environment that everyone lives in today is much more perfect than the environment that Xianyu lived in back then. It is recommended to use Flutter Boost for hybrid development. In some scenarios, when you encounter problems and cannot respond quickly, you can also use native for hybrid engineering. In terms of complexity, the overall complexity is average by simply introducing the hybrid stack capability.

InfoQ: There are rumors that Xianyu did not adopt Flutter in new business, which caused many people to give up the idea of ​​Flutter. So what factors have you considered in the technology selection of new business?

Yu Jia (Zong Xin): As a technology decision maker, you should avoid being kidnapped by a certain technology and make mistakes in the process of landing. Like other technologies, Flutter is ultimately designed to help teams realize business value. At the same time, it is only a technology on the mobile side, and both praise and abuse are inappropriate. This is also the reason why I especially don't want to respond to this matter in public, because the technology itself depends on the applicable scenarios.

Judging from the current staff size and business scale of Xianyu. For architecture design, my philosophy is to strive for consistency and simplicity of architecture as much as possible.

In the future, the entire client organization will be Dart First from the perspective of language, and minimize the R&D investment on both sides. The choice of other containers is mainly based on H5. In the future, the access of other containers will be minimized, and the front-end development will also return to the standard route.

There are two benefits here:

The organization cost is the lowest. The organization cost includes the learning cost, collaboration cost, etc. of the students. Multiple technology stacks and containers will bring additional costs, which I do not want to see.

Architectural consistency helps both R&D efficiency and quality. For example, as the complexity of the business increases, the soaring memory and package size problems caused by multiple containers are fatal and almost insoluble, which requires architects to make decisions about what to kill and what to leave behind. Back to the R&D efficiency, the supporting tools and processes must be extended around a type of container and language. If there are too many solutions, additional supporting facilities are required in each direction, the cost and benefit are very low, and the happiness of R&D is also very high. Low.

From this design point of view, we have a few clear choices:

*Use Flutter as the preferred solution in the default scenario;
*Use H5 as the preferred implementation solution in launching activities, front-end shopping guides, very uncertain new businesses, and management back-end;
*In very few scenarios, for example, there is already a complete SDK with UI support such as live broadcast, and in the future, the middle-stage shooting function SDK is also a part of its own UI. If you want to switch, Native has the lowest cost and chooses Native. In addition, Flutter currently has certain performance problems when loading on the home page, so Native is still used. From a long-term perspective, it may be directly changed to Flutter with the revision to a certain extent in the future.

About future development

InfoQ: After using Flutter for many years, looking back now, which companies and which scenarios do you think are suitable for Flutter?

Yu Jia (Zong Xin): At present, it seems that there are several typical scenarios that are more suitable:

For small front-end products under the China-Taiwan strategy, from the organization of large companies, Ali, Toutiao, and Meituan all have relatively complete Flutter organizations or internal technical communities that can provide some basic services, ensuring that Flutter-based infrastructure is in the process of early investment. In the future, the business team can focus more on business research and development, and worry less about the cost of filling holes in the process.

For start-up apps of small and medium-sized enterprises, in the case of insufficient human resources and resources, the team that hopes to run through the online verification process can try to use Flutter for research and development. In my own actual interview and industry communication process, this kind of situation Also quite typical. This method can avoid excessive investment in upfront costs, and is more flexible in personnel deployment.

In addition, this view has not been verified, but it should be logically feasible. In the future, for the internal process tools of enterprises, some apps with strong tool attributes of government departments can try to use Flutter. Because from what I know so far, in terms of applications on the enterprise side, there are many apps in the overall ToB (Meituan merchant side) and ToD (such as Ele.me rider side) scenarios. From a horizontal comparison, the scenarios are similar, which means that more medium and long-tail applications may be the main scenarios of Flutter technology.

InfoQ: What do you think Flutter needs to improve in the future?

Yu Jia (Zong Xin): From what I have communicated with some first-line developers after the release of Flutter 2.0, Flutter still needs to promote the optimization of cross-end performance and detailed experience. In the past year, Flutter has done a good job in the major strategic direction (cross-terminal), and has made achievements on the PC and Web side, and has made some progress in cooperation with car companies and operating system manufacturers. However, there is still a long way to go to return to the product experience and developer experience. In many cases, for a strict business side, the experience of small fonts and controls will become the final reason for not choosing this technology. This part hopes that the whole open source community will have some progress in the new year. Inside our AliFlutter organization, the students headed by the UC core team have a lot of precipitation and PR in this regard, and have a lot of experience improvement in the development of the internal engine. In the future, in the AliFlutter organization, in addition to improving the infrastructure of the entire company, we will pay more attention to the detailed experience, and precipitate some best practices for other developers. You will see our latest published books within 2 months, welcome to communicate.

InfoQ: Flutter 2.0 is here, will Flutter become the mainstream choice?

Yu Jia (Zong Xin): I can talk about my judgment on the future of Flutter. On the one hand, in the future, the operating system may be split, and in the multi-terminal scenario, Flutter will have a relatively good development. The cross-platform itself has great demands on the cost side of enterprises, especially Internet companies. However, from historical experience, Flutter is only a rendering engine. Even in today's game development, some functional modules (such as community/live broadcast functions) are still mixed frameworks when the game engine and supporting tools are perfected, so Hybrid development must always exist in the end. Whether it can become the mainstream of the entire mobile R&D in the future, I can't give an answer, but what is certain is that after the ecology is more perfect, it will become another common technology developed by clients in a certain historical stage. choose.

Guest introduction:

Yu Jia, the flower name is Zong Xin, the client in charge of the Xianyu technical team. He joined Alibaba as a fresh graduate in 2012. He experienced an important period of the group's wireless transformation. He participated in the design and development of many of the group's heavyweight apps and mobile middleware. He is a client veteran for many years. In 2014, I participated in the architecture upgrade of the iOS client of mobile Taobao, which completed the support for the parallel development of a hundred-person team for the first time. Taobao has laid a solid foundation as a future group wireless middle station. In 2015, he joined the Xianyu client team in charge of the client architecture and team building. During the work, he completed the overall architecture design of the Xianyu client based on the Flutter hybrid architecture, and improved the continuous integration and high-availability system support for Flutter in the engineering system. At the same time, the Flutterization of Xianyu's main link business has been promoted. In the future, we will continue to pay attention to the evolution and development trend of terminal technology.

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00

phone Contact Us