What is FLUTTER?
Flutter is Google's mobile UI framework that quickly builds high quality native user interfaces on iOS and Android. Flutter can work with existing code. In the world, Flutter is being used by more and more developers and organizations, and flutter is completely free, open source.
Mobile end cross-platform framework
In traditional native development, we generally maintain Android, iOS two development teams, version iteration, no matter human cost, or test costs. This may not feel deep about our ordinary Android programmers, or we don't care. But standing at the company's point of view, if there is a set of code, you can directly develop Android APK and iOS IPA, do you mean that I just need to have a team that has maintained this code? From the cost of human labor, I can make some salary less. In the development of the perspective, a set of code can also complete the reuse, test, and the unity of the UI style. As early as 2008, a frame called "Phonegap" was awarded and began to support the Android platform. Now we said that PhoneGap generally refers to "Cordova". It is the open source project that PhoneGap contributed to Apache, which is the core code that is pulled out from PhoneGap, which is the core engine that drivers the PhoneGap. The two maintained a common source code component, only the name and package are different. PhoneGap is a technology that uses HTML, CSS, and JavaScript to complete cross-platform development, when PhoneGap declares close to native performance. However, its working principle is based on WebView, then use Javainterface to complete interaction with native code. We call this tool for WebView JavaScript Bridge (Jsbridge). This way, can solve the needs of cross-platform and dynamic updates, but we all know that Android WebView is very poor, and JavaScript is an interpreted language, which does not need to be compiled, explained in runtime, which causes JavaScript performance performance is too low. At the same time, because of Android itself, use memory consumed during the WebView process, there is no way to make timely recovery when you don't need to use, which will cause our available memory to less and less, eventually OOM. So the emergence of this framework like flutter is inevitable, existing cross-platform framework, such as RN, based on JS, due to JS execution performance, causing cross-platform application performance to break through the bottleneck. Flutter uses JIT compiles in Debug, supports thermal overload, improve our development efficiency, and RELEASE is directly compiled into machine code to achieve better performance. From a design perspective, Flutter provides a very rich Widget component that allows us to easily implement Android or iOS-style UI effects.
FLUTTER Advantage
Thermal load
The page changes each time, it is not necessary to manually refresh, which can be automatically refreshed. That is, heat overload is supported during the development process.
Unified UI
Flutter provides a rich built-in UI component --Material Design (for Android) and CUPERTINO (for iOS), you don't need to worry about what you do in numerous devices.
FLUTTER architecture
Flutter's architecture is mainly divided into three layers: framework, engine, and embedder.
1.Framework uses DART implementation, including the Material Design Widget, Cupertino, Widgets, Text / Image / Button, etc. of the text, the text / image / button, etc. Widgets, rendering, animation, gestures, etc. The core code of this section is: FLUTTER PACKAGE under the FLUTTER warehouse, and IO, Async, UI under the Sky_Engine warehouse (DART: UI library provides Package between the flutter framework and the engine).
2.Engine is implemented using C ++, including: Skia, Dart, and Text. SKIA is an open source 2D graphics library, C ++ 2D drawing engine, calling GPU to complete rendering, providing a general API for a variety of hardware and software platforms.
3. Embedder is an embedded layer that embeds Flutter to each platform, and the main tasks do this include rendering Surface settings, thread settings, and plugins. As you can see here, the Flutter's platform-related layer is very low, the platform (such as iOS) is just providing a canvas, and the remaining rendering related logic is inside the flutter, which makes it a good span consistency.
DART language introduction
Features:
JIT-based rapid development cycle
FLUTTER uses the DART language, using JIT mode in the development phase, so that every change must be compiled, which greatly saves development time;
AOT-based release package Lutter can generate efficient ARM code through AOT to ensure application performance.
In order to quickly and smooth user experiences, you need to run a lot of code in each animation frame, and you can't have periodic pauses, otherwise you will cause the frame.
Single thread:
No lockup, there is no data competition and variable status synchronization, and there is no thread context to switch the performance loss and lock caused by the lock.
Garbage collection
The multi-generation unlocked garbage collector, which is specifically created and destroyed for a large number of Widgets objects common in the UI framework.
Advantages of Flutter and RN
Rn is passed through bridge to Native through Bridge to complete the original drawing, because frequent cross-bridge calls, resulting in a performance problem such as Carton.
FLUTTER uses DVM (DART virtual machine) to reduce the interaction of the bridge, perform these compiled native code directly during the running period, just like the native development, no longer need bridge to serve as an intermediary role
New development language, can work together with Objective-c to build an Apple platform-based application.
SWIFT is a new development language published on WWDC2014. From the demonstration video and the standard document on the App Store, the syntax content is mixed with OC, JS, Python, simple, easy to use, and can be used with OC. As an apple independently released support development language, several application demonstrations and cooperation development companies have been tested, and it is believed that it will be wider in the future. A new business strategy of Apple in a sense will attract more developers to enhance the application quantity of App Store and Mac Store.