Dart: The Language behind Flutter and Fuchsia OS.

Harshu Incorporation
4 min readOct 31, 2021
Dart Language

Flutter 1.0 is officially announced on Dec 04, 2018. After that, the demand for dart programmers is gaining popularity now. Because entire flutter app development is completely based on a dart.

It seems that tech-giant Google has some big plans with the language. That’s why dart is implemented on two big projects including flutter and fuchsia OS.

Here is a quick intro of dart’s features, use-cases, and its humongous power Which will give you an answer to why Google choose it for flutter and fuchsia OS.

Dart was first unveiled at the GOTO conference in Denmark on October 10, 2011. Dart 1.0 was released in November 2013 and Dart 2.0 was released in August 2018 with a sound-type system.

Dart is a General Purpose Language originally developed by Google.

Dart is a very powerful language that you can use to write from simple scripts to full-featured native apps using flutter. It is mainly used in four platforms including Native Mobile App, Web App, Desktop App, and Server-Side App.

  • Designed By — Lars Bak and Kasper Lund
  • First appeared — October 10, 2011
  • Typing discipline1.x: Optional, 2.x: Static
  • License — BSD
  • File Extensions — .dart

Dart supports mainly five types of paradigms:

  1. Scripting
  2. Object-Oriented
  3. Imperative
  4. Reflective
  5. functional

Dart is influenced by five languages:

Dart is a member of the ALGOL language family, alongside C, C++, Java, C#, JavaScript, and others.

So if you are from C, Swift, or Java’s background you’ll feel just like your hometown in a dart. Its syntax is closer to C.

  1. C#
  2. JavaScript
  3. Erlang
  4. Smalltalk
  5. Strongtalk

It has four major implementations:

  1. Dart VM
  2. dart2js compiler
  3. Flutter
  4. Fuchsia OS

Ways to Run the Dart Code

Dart is implemented on a wide range of platforms. So it needs multiple ways to run the dart code depending on the platform. Below are three main ways to run the dart code:

  1. Through Transcompile to JavaScript
  2. Through DartVM
  3. Through the AOT compilation process

Through Transcompile to JavaScript

Dart code can be compiled to JavaScript so that it can run on browsers. For that Dart uses a source-to-source compiler (dart2js) to convert its code to JavaScript.

So when you want to deploy your Dart code on browsers, first you need to convert that code via the dart2js compiler. dart2js will convert your code into JavaScript. So it can run on all modern browsers.

Here amazing thing is, dart2js will not only produce JavaScript code, instead it will produce optimized JavaScript code. That means compared to hand-written JavaScript code, your converted dart code will run faster on browsers.

Through DartVM

Just like Java has JVM, Dart has its own virtual machine for running dart code-named DartVM.

If you want to create console apps or server apps you can use DartVM to run Dart code. DartVM is a highly optimized, powerful, and fast virtual machine that can run your Dart code in a fraction of seconds.

DartVM is directly coming with Dart SDK. You just need to setup SDK’s path in your environment variables and you are ready to go. Your imagination is the only limit now…

Through the AOT compilation process

AOT means Ahead-Of-Time compilation is the process of compilation in which we covert a higher-level code such as C, C++, or an intermediate code such as Java Byte Code or .NET Framework’s CIL code (Common Intermediate Language), into a native machine code which is system-dependent code. And that code can be run on a particular machine that understands it.

AOT produces machine-optimized code, just like a standard native compiler.

Apps built with Flutter use the same AOT compilation process to generate native Android and iOS apps from a single code base.

SnapShots: For faster code execution

According to Wikipedia: SnapShot is the state of a system at a particular point in time.

The same concept applies here, SnapShots are files which stores object and other runtime data.

So in the next startup whole program does not need to be compiled, the compiler will take saved data from snapshot files and compile only newly added data. Which results in faster startups and code execution.

Snapshots are a core part of DartVM.

There are two types of SnapShot files in dart:

  1. Script snapshots
  2. Full snapshots

Script SnapShots

Dart programs can be compiled into SnapShots files. These files contain the program code and dependencies pre-parsed and ready to execute. This allows fast start-ups.

Full SnapShots

The dart core libraries can be compiled into a snapshot file which allows fast loading of the libraries.

Dart VM has a prebuild snapshot for the core libraries which is loaded at runtime. That’s how DartVM provides faster code execution.

So, guys, these are the features and use-cases of a dart. It’s a very powerful language itself. If you’re planning to go into the app-development domain then you should definitely start to learn dart and flutter. I’ll try to share as much as I can on dart and flutter. Feel free to let me know if I missed something. I’ll definitely like to learn that.

Till then Keep Coding, Keep Coding.

For More Information Check Out Below Links

--

--

Harshu Incorporation

Harshu Inc. is a Missionary Tech Company that aims to create solutions via technology for Humanity.