Understanding Dart

Awais Ur Rehman
2 min readApr 17, 2020

The Dart Language, developed by Google. Dart is a programming language that can be used to develop web, desktop,server side, and mobile applications. Dart is the programming language used to code Flutter apps, enabling it to provide the best experience to the developer for the creation of High-level mobile applications. so lets explore what Dart provides and how it works.

dart aims to aggregate the benefits of most of the High-level language with mature language features,including the following :

  • Productive tooling : This includes tools to analyze code, integrated development environment (IDE) plugins, and big package ecosystems.
  • Garbage collection : This manages or deals with memory deallocation (mainly memory occupied by object that are no longer in use ).
  • Type annotations (optional) : This is for those who want security and consistency to control all of the data in an application .
  • Statically typed : Although type annotations are optional , Dart is type-safe and uses type inference to analyze types in runtime. This feature is important for finding bugs during compile time .
  • Portability : This is not only for web (transpiled to JS) but it can be natively compiled to ARM andd x86 code.

How Dart Works

To understand where the language’s flexibility came from we need to know how we can run dart code. This is done in two ways.

  • Dart Virtual Machines (VMs)
  • JavaScript compilations

lets see in the daigram :

Dart VM and JS compilation

dart code can be run in a Dart-capable environment. A Dart-capable environment provides essential to an app, such as followings:

  • Runtime systems
  • Dart code libraries
  • Garbage collectors

The execution of Dart Code operates in two modes :

  • Just-In-Time(JIT) compilation
  • Ahead-Of-Time(AOT) compilation
  • A JIT compilaation is where the source code is loaded and compiled to native machine ode by Dart VM on the fly. it is used to run code in the command line interface or when you are developing a mobile app in order to use features such as debugging and hot reloading.
  • An AOT compilation is where 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.

NOTE :

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.

--

--

Awais Ur Rehman

I am flutter/dart developer trying to learn new things .