It has been more than two years since the Flutter began.

However, the world has been suffering from client for a long time. Whether it is Android or iOS, the implementation of each end is different, the development difficulty is different, and the implementation effect is different. The development time is double, and the bugfix is double. These cross-platform solutions didn’t escape the constraints of native development until The advent of Flutter, which opened up a whole new era of cross-platform development. Cross-platform solutions with self-rendering engines opened up the bright road to cross-platform development, and so far, Flutter has been a success.

Where there are people, there is king Roll.

In the same way, Google incubates Compose. In terms of performance, Compose and Flutter are very similar. I can’t say they are exactly the same, but there are still differences. But the whole thing is declarative programming, which has been one of the hottest programming trends of the decade.

So why does it have to be done internally at Google?

The reason for this is because of different teams. Flutter was created by the Chrome team as a cross-platform framework by a group of Web developers, and it was designed to be cross-platform from the very beginning, while Compose was created by the Android team. Is a refactoring to solve the problem that the current View architecture can no longer adapt to the declarative programming paradigm.

So, from that point of view, There’s a lot of front end to The layout, to the style of the code, and the work that Flutter does is cross-platform, so there’s a little bit of polish on all sides, whether it’s state management or data flow. There is no official solution yet, but the self-rendering engine of The Flutter allows it to render as much as it wants without being limited to native renderings, so if your App is more of a display oriented App, Flutter can make your App more expressive.

However, the problem with Flutter is also obvious. Due to its independence, there are a lot of problems with blending. When Flutter is embedded in the native App, the interaction and sharing of resources and images becomes a more difficult problem.

“Compose”?

In terms of time, Compose was born later than Flutter, but it fully absorbed all the advantages of Flutter. If you have used both frameworks, you can find the shadow of each other in them.

For Compose, the first priority is not to solve cross-platform problems, but to improve the efficiency of native App development. Instead of using the imperative View architecture, Compose provides a full declarative UI architecture.

For example, Compose is something that can be seamlessly mixed up with an existing native App, and you can’t call it a native App, because it’s a native App, but it’s just a framework for implementing a new syntax, declarative syntax, The XML layout is completely abandoned, so ViewBinding and DataBinding are a thing of the past. Step back and let the world be bigger. In addition, Kotlin’s increasingly mature language mechanism, a large amount of syntax sugar and compiler black technology have made Compose more powerful. Therefore, from the very beginning, Compose has a parking lot ahead of Flutter on the native road, whether it is coroutine, Flow or JetPack component. Compose can be seamlessly provided to Compose, so that problems with state management and data flow can be solved easily. In particular, Compose of ConstraintLayout and MotionLayout, which makes native layout programming much better than Flutter.

So the question is, which one should I use?

In the world of workers, there is no single choice.

Of course, people should be open-minded, committed to excellence, enlightened, and humble when it comes to new technologies.

First of all, Flutter and Compose are not in conflict. I’m a native developer, but that doesn’t stop me from learning about Flutter. My open source project, Flutter Dojo, github.com/xuyisheng/f… For example, “Compose”, “Compose”, “Compose”, “Compose”, “Compose”, “Compose”, “Compose”, “Compose”, We must be humble about how to use these new technologies and how they are designed. The sea accepts all rivers.

Second, technology is not a choice, but it has priority.

  • If your project is new and you want to develop quickly and support multiple platforms, Flutter is definitely your best choice.
  • If you’re a native developer and you need to be more efficient, Compose and Kotlin are definitely a technical barrier that you can’t get away with.