Flutter is an efficient, cross-platform, free, open source SDK that allows developers to build great apps that match the native experience on both Android and iOS with a single set of code. With Flutter’s upgrade from 1.0 to 1.2, we’ve also collected some of the developer’s concerns from the community, and we’ll be answering them in a series from shallow to deep. If you already know about Flutter, try answering the questions you see and then compare them with our answers to further understand Flutter.

Question 1: What technology is used to build Flutter?

Flutter is built using C, C++, Dart and Skia (2D rendering engine). You can see the architecture diagram below.

Question 2: How does Flutter run my code on Android?

The ENGINE’s C and C++ code is compiled using Android’s NDK. The Dart code (SDK and yours) is ahead-of-time (AOT) compiled from local ARM and x86 libraries. These libraries are included in an Android “Runner” project, and the entire package is compiled into an APK. When the application starts, it loads the Flutter library. Any rendering, input, or event handling is delegate to the compiled Flutter and application code. This works much like many game engines.

The Dart code was run using a VIRTUAL machine (VM) in Debug mode (so the word “Debug” was displayed to warn the developer that it was slightly slower) so Stateful Hot Reload could be enabled.

Question 3: How does Flutter run my code on iOS?

The ENGINE’s C and C++ code is compiled using LLVM. The Dart code (SDK’s and yours) is ahead-of-time (AOT) compiled from local ARM libraries. These libraries are included in an iOS “Runner” project, and the entire package is compiled into an.ipA. When the application starts, it loads the Flutter library. Any rendering, input, or event handling is delegate to the compiled Flutter and application code. This works much like many game engines.

The Dart code was run using a VIRTUAL machine (VM) in Debug mode (so the word “Debug” was displayed to warn the developer that it was slightly slower) so Stateful Hot Reload could be enabled.

Q4: Does the Flutter use the system’s OEM widgets?

Don’t. Instead, Flutter provides its own set of widgets (including Material Design and ios-style Cupertino Widgets) that are managed and rendered by Flutter’s framework and engine.

We hope to end up with higher quality apps. The quality and performance of Flutter applications will be limited by the quality of those widgets if we use them directly from OEM.

In Android, for example, there is a hard-coded set of gestures and fixed calculation rules to distinguish between them. In Flutter, you can write your own gesture recognizer, which has the highest priority in the gesture system. In addition, two widgets created by different people can be coordinated to disambiguate gestures.

  • Gesture system
  • Flutter. Dev/docs/develo…

Today’s trends in app design indicate that many designers and users want dynamic UI, as well as brand expression. To achieve this level of aesthetic customization, Flutter architecture tends to drive pixels directly, rather than handing them over to OEM widgets.

Using the same renderer, framework, and widgets means it’s much easier to release iOS and Android versions of your app at the same time without the effort and cost of planning and synchronizing two separate code bases and feature sets.

In addition, using a single language, a single framework, and the same set of libraries for all UIs (whether your UI is different or basically the same on each mobile platform) also helps you reduce application development and maintenance costs.

Question 5: What happens when my mobile OS is updated and new widgets are added?

The Flutter team closely monitors the usage and demand for widgets from iOS and Android, and works with the community to provide build support for new widgets. This support may come in the form of lower-level framework functionality, new editable composite widgets, or entirely new widget implementations.

Flutter’s layered architecture is designed to support many widget libraries. We encourage and support the community to build and maintain widget libraries.

Question 6: What happens when my mobile OS is updated with new platform features?

Flutter’s interop and Plugin systems are designed to give developers immediate access to new mobile operating system features and functions. Instead of waiting for the Flutter team to provide access to new system features, developers can use them themselves at the first opportunity.

Q7: What operating system can I use to develop Flutter applications?

Flutter can be developed using Linux, Mac and Windows.

Question 8. In what language is Flutter written?

We compared a number of development languages and runtimes and ended up using Dart to write frameworks and widgets. The underlying graphics framework and the Dart virtual machine are implemented in C/C++.

Question 9: Why did Flutter choose to use Dart?

Flutter is evaluated across four main dimensions, taking into account the needs of framework developers, application developers and end users. We found that some languages did meet the requirements in some dimensions, but Dart scored high on all of the dimensions assessed and met all of our requirements and criteria.

Dart’s runtime and compiler support two key features of Flutter: A rapid jIT-based development cycle, which allows support for deformation and stateful hot overloading in typed languages, and an AOT compiler that produces efficient ARM code, ensuring fast startup capabilities and predictable production run performance.

In addition, we have been fortunate to work closely with the Dart community, which has invested resources in improving Dart to make it easier to use in Flutter. For example, when we adopted Dart, the language did not have the AOT toolchain for generating native binaries that would help achieve consistent high performance, but after the Dart team built these tools for Flutter, this absence disappeared. Similarly, the Dart VM was previously optimized for throughput, but the team is now optimizing for latency, which is more important to address the Flutter workload.

At the time of evaluation, Dart scored highly on the following key criteria:

Developer productivity. One of the main values of Flutter is that it allows developers to create apps for iOS and Android using the same code base, saving development resources. Using an efficient language can further improve the developer’s productivity and make Flutter more attractive. This is very important to both our framework development team and the end developers. Much of Flutter uses the same language as we provide for developers, so we needed to be efficient across hundreds of thousands of lines of code without sacrificing the affinity and readability of the frameworks and widgets we developed.

Object oriented. For Flutter, we needed a language that suited its problem domain: creating a visual user experience. This is an area that has decades of experience building OBJECT-ORIENTED UI frameworks. While we could use a non-object-oriented language, it would mean “reinventing the wheel” in order to solve several difficult problems. In addition, most developers have experience with object oriented development, so it is easier to learn how to develop with Flutter.

Stable and predictable high performance performance. We want developers to create a fast and fluid user experience with Flutter. To do this, we need to be able to run a lot of final developer code during each animation frame. This means that we need a language that has both high performance and the ability to avoid periodic interrupts that affect frame rates, known as “predictability.”

Fast memory allocation. The functional flow used by the Flutter framework relies heavily on the underlying memory allocator to efficiently allocate memory for small, short-life content. The process was developed in a language that supports this allocation mechanism and does not work effectively in a language that lacks it.

Q10. Does the Flutter run any Dart code?

Flutter should be able to run most DART code that does not reference DART :mirrors or DART: HTML (either directly or indirectly).

11. How big is the Flutter engine?

In December 2018, we measured the download volume of a minimal version of the Flutter application (i.e., no Material components, only a Center widget built using the Flutter Build APK). This packaged and compressed APK is about 4.06MB.

  • The simplest app on GitHub
  • Github.com/flutter/flu…

For the simplest application, the volume of the core engine is about 2.7 MB (after compression), the volume of the framework and application code is about 820.6 KB (after compression), and the volume of the LICENSE file is 53.5 KB (after compression). The necessary Java code (classes.dex) is 61.8 KB (compressed) and has about 450.4 KB of ICU data (compressed).

These numbers are measured by ApkAnalyzer built into Android Studio.

  • apkanalyzer
  • Developer. The android. Google. Cn/studio/comm…

On iOS, the release IPA of the same App downloaded on the iPhone X was 10.8MB, according to App Store Connect. IPA is larger than APK because Apple encrypts the binary files in IPA, which reduces the compression efficiency.

  • IOS App Store Specific Considerations — About encryption
  • Developer.apple.com/library/arc…

Of course, your actual situation may differ from what we describe, and we recommend that you measure the volume of your application. Want to measure the volume of Android applications, please run the flutter build apk, and putting the apk (build/app/outputs/apk/release/app – the apk) loaded into the Android in the Studio, To obtain detailed volume reports. To measure your iOS App, load the release IPA into App Store Connect and get the volume report.

  • Using Android Studio load APK (developer. The Android. Google. Cn/Studio/buil…
  • Load IPA with App Store Connect (flutter. Dev /docs/deploy…)