Community Blog Is Xianyu Quietly Giving up Flutter?

Is Xianyu Quietly Giving up Flutter?

This article describes the views expressed by Yu Jia regarding Xianyu's current position on Flutter, including the challenges, innovations, and future plans.

By Yu Jia (Zongxin), client leader of the Xianyu technical team, and Tina, editor at InfoQ

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

After that, the Xianyu team of fewer than 15 people made some innovations in the engineering architecture, hybrid stack calls, package building, and collaboration mode, ensuring that Flutter can be integrated into the existing client engineering system. From 2017 to 2019, Xianyu has also constantly fixed bugs to improve the stability of Flutter and synchronized it with Google and developed a set of its own hybrid technology solutions in practice - which opened sources for the Flutter Boost engine.

In 2019, Xianyu began a large-scale landing to promote the application of Flutter in Xianyu. In 2020, the main links of Xianyu online had almost entirely accepted Flutter. In the past two years, Flutter has gradually landed in other enterprises, but at the same time, there are constant voices of doubt. There are even rumors that "Xianyu's new business has abandoned Flutter" and "I believe Xianyu has encountered great difficulties."

So, as a pioneer and pathfinder of Flutter, has Xiianyu taken any detours in the exploration process of the past few years? What kind of challenges does Xianyu face now? Will Flutter be abandoned? What technology has the new business chosen? What are the corresponding principles for selecting a technology? In response to these questions, Yu Jia (Zongxin), the client leader of the Xianyu technical team, will give us answers one by one.


The First Team to Introduce Flutter in China

What was the main problem that Xianyu was trying to solve when it introduced Flutter?

Yu Jia (Zongxin): During the research stage in 2017, the client team of Xianyu had less than 15 people, and Xianyu's business scenario can be called a "small Taobao," which is relatively complicated. The first problem we need to solve is sharing manpower at multiple ends. The benefits of multi-end manpower not only allow one person to develop both ends but also represent better flexibility in the deployment of research and development (R&D) resources. In other words, the team's iOS versus Android ratio no longer needs to be 1:1, while the base of Android engineers on the market is much larger than that of iOS.

In addition, we hope that this technology fits the mobile R&D technology stack rather than the frontend technology stack. For RN and Weex, the toolchain and R&D habits are quite different. In the end, we expect the experience of this technology can be close to native, and Flutter under AOT basically met our requirements at that time. In the actual testing process, Flutter performs better than Native in the low-end machine with the same detail page without deep optimization. Therefore, Flutter was selected based on these three conditions at that time.

During the trial investment in 2018, the entire infrastructure construction and exploration brought certain costs. In 2019, the team officially began to use Flutter for research and development. Currently, 70 percent of the team's commits come from Dart, and it can be said that we have fulfilled our original expectations. In the actual R&D process, it is possible to accomplish the goal of one demand for one client.

Many people doubted the Dart language and thought it was different and not very popular. There are still problems such as multi-level nesting. What do you think of the application of the new language?

Yu Jia (Zongxin): Language is one of the factors in our choice of technical solutions, but it is relatively weak. We will look at it from several perspectives:

  • Language background: From our point of view, Dart is developed by a major manufacturer and has a long history.
  • Cost of learning the language: In terms of syntactic sugar and learning curve, the cost of Dart is relatively low, and the Android students are quick to get started. In addition, iOS students who are familiar with Swift can quickly get started, too. Many characteristics of modern language are similar. This part is its advantage.
  • Other advantages: Dart has some unique benefits, such as the compilation products supporting AOT and JIT are flexible. AOT also has obvious performance advantages.
  • Future trend: In the fourth quarter of 2020, Dart's Github Pull Request has reached 13th in the entire network, surpassing Kotlin (15), Swift (16), and Objective-C (18). As a new language in the field of mobile technology, the growth is still outstanding.

For problems like multi-level nesting, we can avoid them by further abstracting some control classes or methods, which is not a big problem.

What are the key innovations made by Xianyu after it introduced Flutter? What are the benefits of using Flutter?

Yu Jia (Zongxin): Xianyu has done many innovations and has applied for a lot of patents internally.

  • Our open-source project, Flutter Boost, has completely changed some official roadmaps of Flutter. Currently, Add2ExistApp is the most popular R&D method in the industry. Hybrid development, on the one hand, helps businesses migrate more smoothly to the new technology stack. On the other hand, it can better use the existing Native capabilities and significantly reduce the work of repeated development.
  • The surface texture solution for audio and video is also a standard product for leading manufacturers in the industry. The cache management on the Native and Flutter sides has been unified with its help, resulting in significant performance improvements.
  • Flutter APM, based on the performance stability collection and processing plan of the Flutter technology stack, which is jointly built by multiple BUs within the group to provide services for the large AliFlutter organization currently.
  • Flutter DX, the Flutter-related dynamic template solution, is compatible with the group's existing Native templates. It helps in smooth business migration and provides partial 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 now have some new directions in preparation. We have also invested in Flutter-based R&D processes and tools. In the future, if you are interested, you can go to the industry conference organized by InfoQ to communicate with us.

Have Xianyu Ever Thought About Giving up Flutter?

What are the biggest challenges you have encountered in Flutter development in the last year or two? Are the challenges the same as when you first started using Flutter?

Yu Jia (Zongxin): In the early years of Xianyu, as a pioneer in the entire industry, the main challenge was that the entire technological ecology was poor and we had to do everything by ourselves. The other is that the stability of the early engine has a big problem.

In recent years, with the in-depth use of the whole technology and the rapid business development behind Xianyu, more and more experience-related problems have been mentioned. Therefore, we have made a significant revision of the entire product last year, and the goal of the client-side is to optimize and create a better user-side product experience.

Therefore, after the ecosystem is gradually improved, our challenge is how to achieve a more refined user experience through Flutter. Last year, this part did take us a lot of effort. Based on this proposition, we have developed many internal Flutter-based detection tools for memory and lagging. To add to it, we have some more specific methods for memory optimization and lagging optimization. Still, it must be said that all the details of optimization are relatively labor-intensive, and both Native and Flutter have to invest considerable effort. Hence, we are currently recruiting for the whole industry on the client-side and hope that students interested in exploring the Flutter field will contact me.

Under the hybrid R&D system, Xianyu has also customized its engine. So what are the main problems of the official solution? For the average small business, will hybrid development be too complex?

Yu Jia (Zongxin): Xianyu has made many changes to the engine in the early stage. I have some reflections on my own about that time. On the one hand, it is because Flutter is not perfect. On the other hand, in about 2018, we do not have a deep understanding of our engines. Most of the time, we could have used higher-level solutions to solve problems, which indirectly makes it difficult for many of our engine customization modifications to be incorporated 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 must talk about customization, there are still some problems on the performance side. For example, the current homepage of Xianyu is still native and does not use Flutter because the loading experience after the replacement is not suitable. In addition, we have tried to solve the lagging problem of the long-list side that has been criticized for a long time to a certain extent through the upper-level framework. Next, we may need the lower-level engine to help optimize it. Some other issues, including inconsistent fonts at both ends, and volatile input box experience, require long-term official optimization.

At present, we mainly hope to follow the backbone branch and try not to modify the Flutter code. The Xianyu team has some engine-side experts and relies on the ecosystem of the AliFlutter group. In the entire AliFlutter organization, different BUs are also 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 support based on the construction of relevant infrastructure. In this way, most problems can be solved in large manufacturers by using internal open-source communities to develop with confidence.

For small and medium-sized enterprises, it is necessary to be clear about the scenarios they face. If the early development is rapid, there can be some compromises on the details. Choosing Flutter is a relatively clear path. The current environment is much better than the one in which Xianyu was born. We recommend that you use Flutter Boost for hybrid development. In some scenarios, if you encounter problems that require a quick response, you can also use Native in hybrid projects for backup purposes. The overall complexity is average if only introduce the hybrid stack.

There are rumors that Xianyu has not adopted Flutter in its new business, which makes many people think that Xianyu has abandoned Flutter. So what factors have you considered in the technology selection of your new business?

Yu Jia (Zongxin): As a technical decision-maker, one should avoid being kidnapped by a specific technology and making mistakes in the implementation process. Flutter, like other technologies, is ultimately to help teams realize business value. At the same time, it is only a technology on the mobile terminal. It is not appropriate to praise or abuse it too much. This is also why I particularly do not want to respond to this matter in front of the public because the technology itself depends on the application scenario.

From the current personnel size and the business scale of Xianyu, my philosophy is to pursue consistency and conciseness as much as possible for architecture design.

From the language perspective, the whole client organization will put Dart first in the future and minimize the investment in research and development at both ends. The choice of other containers is mainly based on H5. In the future, the access to other containers will be reduced as much as possible, and frontend development will be brought back to the standard path.

There are two advantages:

1) The organizational cost is the lowest, including the learning cost and collaboration cost of students. There will be additional costs caused by multiple technology stacks and containers, which I do not want to see.

2) Architectural consistency contributes to both R&D efficiency and quality. For example, as the business becomes more complex, the memory surge and package size problems caused by multi-container deployment are fatal, and there is almost no solution. This requires the architect to make a decision, abandon something and keep something. Returning to the R&D efficiency, the supporting tools and processes must be expanded around a type of container and language. If there are a lot of solutions, additional supporting facilities are required in each direction, resulting in very few benefits, and the sense of happiness of research and development is also shallow.

From this design point of view, we will have several clear choices:

  • Flutter is the preferred solution by default;
  • H5 is used as the preferred implementation scheme in marketing activities, frontend shopping guides, very uncertain new services, and management backend;
  • In rare scenarios, such as the availability of a complete SDK with UI support, live streaming, and future mid-end shooting SDKs, there will also be UI. To switch, we can prefer Native as it is cost-efficient. In addition, Flutter still has some performance problems when loading the homepage, so Native is still being used. From a long-term development perspective, it may be directly changed to Flutter with the revision.

About Future Development

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

Yu Jia (Zongxin): Currently, it seems that several typical scenarios are suitable:

  • For small front-end products under the mid-end strategy, from the perspective of large companies - such as Alibaba, Toutiao, and Meituan - all have relatively perfect Flutter organizations or internal technical communities that can provide some basic services. This ensures that the costs of the Flutter-based infrastructure are evenly distributed during the initial investment process. In the future implementation process, the companies can focus more on business research and development and worry less about the cost of filling in the process.
  • For start-up apps of small and medium-sized enterprises, if the human resources and cost are insufficient, teams who want to go through the process and go online to verify first can try to use Flutter for research and development. In my own actual interview and industry exchange, this kind of situation is also typical. This method can avoid high upfront costs and is more flexible in personnel deployment.
  • In addition, this view has not been verified, but it should be feasible logically. In the future, we can try to use Flutter for internal process tools and some apps with strong tool attributes in government departments. Because of the current situation, I understand, from the perspective of applications on the enterprise side, the overall ToB (Meituan merchant side) and ToD (such as Ele.me rider side) scenarios apps are particularly numerous. Horizontally, the scenarios are similar. That is to say, more applications with medium and long tails may be the main scenario for Flutter technology.

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

Yu Jia (Zongxin): From the feelings I have shared with some frontline developers after Flutter 2.0 was released, Flutter still needs to promote cross-terminal performance and optimize detail experience. Last year, Flutter did an excellent job in its major strategic direction (cross-terminal), with achievements on the PC and Web sides and some progress in cooperation with car companies and operating system vendors. However, there is still a long way to go when it comes to product experience and developer experience. Sometimes, for a demanding business party, experiences as small as fonts and controls can be the reason for not choosing this technology in the end. In this part, I hope that the entire open-source community can make some progress in the New Year. Within the AliFlutter organization, our students, led by the UC kernel team, have accumulated a lot of experience and PR in this area and have improved significantly in the internal engine. In the future, besides improving the infrastructure of the entire company, we will also pay more attention to the detail experience and accumulate some best practices to other development personnel.

With Flutter2.0 coming, will Flutter become a mainstream choice?

Yu Jia (Zongxin): Let me talk about my judgment on Flutter's future. On the one hand, in the future, the operating system is likely to split. In the multi-terminal scenario, Flutter will have a relatively good development. The cross-platform itself has great demands on the cost side for enterprises, especially Internet companies. However, judging from historical experience, Flutter is only a rendering engine. Even today's game development, with the perfection of the game engine and supporting tools, some function modules (for example, the community and live broadcast functions) are still hybrid frameworks. Therefore, hybrid development always exists. I can't give an answer to the question of whether it can become the mainstream of the whole mobile R&D in the future, but it is inevitable that after the ecology is more accurate, it will become another common technical choice for client-side R&D at a certain stage of history.

Guest Introduction

Yu Jia, nickname Zongxin, is the client leader of the Xianyu technical team. He joined Alibaba after graduation in 2012 and experienced an important period of the group's wireless transformation. He has participated in the design and development of many vital apps and mobile middleware of the group and has been a client-side veteran for many years. In 2014, he participated in the upgrade of the architecture of the iOS client of mobile phone Taobao, which for the first time completed the support for the parallel development of a team of 100 people. In the same year, Alibaba led the normalization of the basic architecture of mobile Tmall clients and the architecture of Mobile Taobao, laying a solid foundation for Taobao's future wireless mid-end. He joined the Xianyu client team in 2015 and took charge of the end-to-end architecture and team building. During his work, he completed the overall architecture design of the Xianyu client based on the Flutter hybrid architecture. He also improves the engineering system for Flutter's continuous integration and high availability system support, promotes the Flutter-based services of the Xianyu main link, and will continue to focus on the evolution and development trend of terminal technologies.

0 0 0
Share on

XianYu Tech

56 posts | 3 followers

You may also like