Brief About Execution of Dart Code
The execution of Dart code operates in two modes—Just-In-Time (JIT) compilation or Ahead-Of-Time (AOT) compilation: JIT compilation A JIT compilation is where the source code is loaded and compiled to native machine code by the Dart VM on the fly. It is used to run code in the commandline interface or when you are developing a mobile app in order to use features such as debugging and hot reloading. AOT compilation An AOT compilation is where the Dart VM and your code are precompiled and the VM works more like a Dart runtime system, providing a garbage collector and various native methods from the Dart software development kit (SDK) to the application. Dart contributes to Flutter's most famous feature, hot reload, which is based on the Dart JIT compiler, allowing fast interactions with live code swaps.To Demonstrate The 'Simple Hello World' program of Dart, we only need the Windows CMD
Note: we created the "simple_hello_world.dart" in Visual Studio Code first. (base) C:\Users\Ashish Jain\OneDrive\Desktop>dir Volume in drive C is Windows Volume Serial Number is 8139-90C0 Directory of C:\Users\Ashish Jain\OneDrive\Desktop 12/20/2021 01:48 PM <DIR> . 12/20/2021 01:48 PM <DIR> .. 12/20/2021 01:48 PM 173 simple_hello_world.dart 12/20/2021 01:59 PM 905 write-up.html 11 File(s) 31,664,672 bytes 11 Dir(s) 66,662,928,384 bytes free (base) C:\Users\Ashish Jain\OneDrive\Desktop>type simple_hello_world.dart main() { // the entrypoint of an Dart app var a = 'world'; // declaring and initializing variable print('hello $a'); // call function to print to display output } (base) C:\Users\Ashish Jain\OneDrive\Desktop> (base) C:\Users\Ashish Jain\OneDrive\Desktop>dart simple_hello_world.dart hello worldYet Another Hello World Program
File: hello_world_with_for_loop.dart (base) C:\Users\Ashish Jain\OneDrive\Desktop>dir Volume in drive C is Windows Volume Serial Number is 8139-90C0 Directory of C:\Users\Ashish Jain\OneDrive\Desktop 12/20/2021 03:46 PM <DIR> . 12/20/2021 03:46 PM <DIR> .. 12/20/2021 01:15 PM 86 hello_world_with_for_loop.dart 14 File(s) 31,774,195 bytes 11 Dir(s) 63,985,053,696 bytes free (base) C:\Users\Ashish Jain\OneDrive\Desktop>type hello_world_with_for_loop.dart void main() { for (int i = 0; i < 5; i++) { print('hello ${i + 1}'); } } (base) C:\Users\Ashish Jain\OneDrive\Desktop>dart hello_world_with_for_loop.dart hello 1 hello 2 hello 3 hello 4 hello 5 (base) C:\Users\Ashish Jain\OneDrive\Desktop>
Monday, December 20, 2021
Hello World Program Using Dart 2
Labels:
Flutter,
Technology
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment