B: well… That’s a hard question to answer. (pulls off the whiskers.) As a pioneer in the field of flutter and the author of popular FLUTTER libraries such as Fish_redux and Flutter_Boost, Xianyu welcomes all developers to use flutter technologies. But let’s talk seriously about the similarities and differences between React Native and flutter:

0x00 Just a quick introduction

React Native

React Native is an open source Facebook framework based on the React concept, which uses JAVASCRIPT to bring Native experience to mobile platforms. The latest version of the official website is 0.5.9.

flutter

Flutter comes from Google. The upper layer of flutter uses the dart language to build cross-platform applications. It accesses the engine layer written in c++ through the platform-specific embedded layer and interacts directly with the GPU through the skia library. AOT compilation of DART code provides excellent computing (CPU) and rendering (GPU) performance. The latest version of the official website is 1.2.

0x01 Cross-platform

The primary reason developers use a cross-platform stack is to save money, so cross-platform capabilities are the first thing to be measured.

Build native mobile apps using JavaScript and React

This means developers can reuse the vast JavaScript ecosystem and elegant React thinking to write RN code, providing a lot of convenience for development.

In terms of implementation principle, RN will hand over the final rendering to Native View after typesetting, which brings the UI performance as native, but also brings some problems to platform consistency. Apart from the inconsistencies in the rendering layer, not using the same JavaScript virtual machine on iOS and Android also creates some dark holes.

The two platforms are not consistent in how gestures are handled, and RN does not officially provide a library to smooth out the differences, although the open source community has a React-Native Mouth-Handler.

Beautiful native apps in record time

Flutter officials boast that it is “unprecedented”. Is it “unprecedented”? We have to evaluate it.

At the programming language level, Flutter uses the DART language to build applications. Dart’s syntax is relatively simple, similar to strongly typed OOP languages such as Java. It also has functional features that make flutter easy to use.

Flutter provides a reactive UI programming model similar to the React idea, making UI development more fancy.

In principle, Flutter uses a single VM (Dart VM) on all platforms, with its own GDI(SKIA). Skia is a 2D graphics library that has been in development for many years and is used by Android and Chrome.

Flutter is its own, from logical computation to rendering rendering, making it a good platform for consistency. The AOT features provided by DART also ensure good online performance.

Multi-platform support

RN currently supports both iOS and Android, and there is an unofficial project called ReactNativeX to make RN run on other platforms.

Flutter was initially supported on iOS and Android, but desktop support is not yet complete. Hummingbird, recently released by the Flutter team, aims to make Flutter applications run in the browser.

From the perspective of multi-platform support, there is not much difference between the two sides. Flutter has some advantages over RN in desktop support, but is not currently available.

0x02 Development convenience

Tool chain

RN has webpack support that is widely used by the front end in packaging and publishing. The official RN provides a browser-based debug tool, which is no different from the debugging method used by the front end students.

The package function for Flutter products is based on the existing packaging tools for Flutter on iOS and Android. The debugging tool for Flutter is also provided by the official website. In addition to the browser-based debugging tool just released, The flutter team provides debugging tools that can be used directly on ides such as Android Studio or VScode.

Debugging convenience

JS debugging has been very mature, here do not expand. Flutter can use the Hot Reload feature integrated with the IDE plugin to load new code at sub-second speeds during debug, making it ideal for sitting down with the designer to make adjustments.

Third-party libraries

RN allows you to use most of the JS libraries, and platform-specific plugins are relatively rich.

Flutter is somewhat lacking in this respect, as it is not comparable in number of libraries to the JS ecosystem. The Flutter/Plugins project provides a wide variety of platform-related plugins available for daily development, and the number of public libraries available at Dart Pubs is growing.

On the mixed development and large app business framework, The open source Flutter_Boost of Idle Fish technology provides the possibility of mixed development with native, while Fish_redux makes the development of complex pages in large apps easier in FLUTTER.

0x03 Future development

When developers choose a technology, they bet their lives on it, and you don’t want to find that technology is going to be obsolete as soon as you get started.

RN is a great project that took mobile development by storm when it was first released. But I have to say that Airbnb’s decision to drop the RN stack was quite a blow to the community, and the reasons are quite convincing.

Flutter matured after the 1.0 release and was authorized as an application-layer framework for Google Fuchsia. As seen in the team’s 2019 roadmap, Flutter is currently focused on refining the details of existing features and Bugfix. In addition, the Flutter team is also developing code push features for the much-anticipated dynamic features. From the current direction of the Flutter team and the author’s actual feeling of flutter in the development of Idle fish, on the whole flutter has been basically stable at the framework level.

From the development process of desktop cross-platform framework, Java GUI from the initial use of PEER (peer-to-peer design mode) AWT, to The performance of Swing graphics drawing interface based on Java extremely slow, and then recognized the best performance is currently the most widely used based on the target platform drawing interface SWT, we can see some historical rules.

Peer (peer-to-peer design mode) is a control in THE AWT that corresponds to a control on the target platform (such as Windows) (does it look similar to RN?). Finally, AWT was abandoned because of low efficiency caused by too many transmission levels of the Peer mode.

SWT and QT, another widely used desktop cross-platform GUI framework, sacrifice some portability (mainly due to direct calls to the target platform’s graphical rendering interface) for high performance of guIs. Flutter uses a similar stack, SKia, to smooth out the differences between drawing interfaces across platforms and provide a unified graphical interface upward.

From this point of view, there is no doubt that Flutter may be a more promising cross-platform framework.

0x04 is at the end

Of course, Facebook is officially refactoring RN, including moving most of the logic to the c++ layer to reduce thread switching overhead and improve performance.

RN and Flutter are two of the most popular frameworks on mobile platforms right now. They are not in opposition to each other.

If you’re a developer interested in new technology, or if you’re looking for a breakthrough on mobile, why not try out Google’s latest work?

* Interested in flutter content, please follow the wechat official account of “Xianyu Technology”. Dozens of excellent articles are waiting for you