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. šŸ˜Š

Top comments (1)

Collapse
 
rajasekaranm profile image
Rajasekaran M

Thanks for useful info :-)