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 hope it's easy and straight forward to understand.
No comments:
Post a Comment