DEV Community

Cover image for Flutter Compilation Process
Jay Tillu😎
Jay Tillu😎

Posted on • Updated on

Flutter Compilation Process

While learning any framework or Programming language its very necessary to understand how platform complies your code. How the whole compilation process is done. It gives you more understanding of platform and core programming concepts. 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 the 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 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 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 in order 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 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 in order to enable stateful hot reload.

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

Jai Hind, Vande Mataram 🇮🇳

Wanna get in touch with me? Here are links. I’ll love to become your friend. 😊

Latest comments (1)

Collapse
 
rajasekaranm profile image
Rajasekaran M

Thanks for useful info :-)