3. Flutter Compilation Process

Jay Tillu
3 min readOct 4, 2019

--

While learning any framework or Programming language it's very necessary to understand how the platform complies with your code. How the whole compilation process is done. It gives you more understanding of the platform and core programming concepts. The next Step in our journey towards learning Flutter is to understand Flutter’s compilation process and how Flutter creates its single code base magic. So let’s get started.

Any app in Flutter is created with the help of three languages Dart, C and C++. Here you can also tell that every Flutter application is a combination of these three language’s code.

For which purpose these three languages are used?

Here Entire Flutter framework is created in Dart and it is also used by us to develop an app. Here also notice that we do not directly use C and C++ code to write apps, instead, C and C++ code is used in the Graphic rendering engine and Dart Virtual machine to perform their tasks.

So now let’s understand how iOS and Android compile these three codes.

How Flutter code compiles for Android

  • Graphics Engine’s C and C++ code are compiled with the help of Android’s NDK (Native Development Kit).
  • The dart code both SDK’s and ours are compiled through an AOT (Ahead-of-Time) compilation process to native ARM and x86 libraries.
  • After successful compilation, the APK file is generated.
  • Any widget rendering, input-output, event handling and so on is done by compiled app code.
  • Here notice that Debug mode builds use a Dart virtual machine to run Dart code to enable stateful hot reload.

How Flutter code compiles for iOS

  • Graphics Engine’s C and C++ code are compiled with the help of LLVM (Low-Level Virtual Machine).
  • The dart code both SDK’s and ours are compiled through the AOT (Ahead-of-Time) compilation process to native ARM libraries.
  • After successful compilation, the IPA (iOS extension same as APK) file is generated.
  • Any widget rendering, input-output, event handling and so on is done by compiled app code.
  • Here notice that Debug mode builds use a Dart virtual machine to run Dart code to enable stateful hot reload.

So that is the flutter’s compilation process for both platforms. I think it’s pretty easy to understand it. If you have any questions please feel free to ask me. And If I miss something please tell me that, I’d love to learn from you.

Learn More about Dart and Flutter

Follow me for more such content.

--

--

Jay Tillu
Jay Tillu

Written by Jay Tillu

Hey There, I'm Jay Tillu a Cybersecurity Researcher. Specialized in Vulnerability Assessment, Penetration Testing, Ethical Hacking & compliance like ISO 27001.

No responses yet