Why Does Flutter Use Dart and Not Another “Better” Language?
“If you want to read this article in Polish, read this article”
This question appears very often in many groups of Dart and Flutter (in many languages, not only in english) and almost all comments compare Dart with Kotlin and TypeScript.
Let’s review a little of history. Flutter was released in May 2017 during the Google I/O. In the same event, Kotlin was presented as an official language for Android apps development. But one thing is the release and other is the start of the development.
The beginning
The development of Flutter was started in 2014 under the name of Sky
and in October of the same year was renamed to … wait for it … Flutter!! 🥳🎉
This can be verified with this issue in its GitHub repository:
Analyzing language candidates
Ok, let’s imagine we are in 2014. There weren’t many alternatives that met the following requirements:
- To have control of the language evolution to create a better framework API.
- Avoid legal conflicts like the
Google vs Oracle
. - The compilation must be as efficient as possible.
Kotlin was 3 years old, but had not yet reached to the mobile world. Regardless of its low popularity at the time, the compiler only generated bytecode for the JVM.
C# was very popular, but wasn’t open enough and It was under Microsoft’s control. This could have generated the same conflicts as with Java.
Golang started to gain popularity in the world in those days and Google was experimenting with MobileX, a package for writing mobile apps with Go. But the syntax was not friendly enough for mobile apps like it was for servers.
TypeScript was 2 years old and under the control of Microsoft. In addition, till today (in 2021) there is no efficient compiler to binary despite the attemps to create a compiler to WASM.
Dart wasn’t popular and was known as an orphan, but it had a compiler for a Dart VM, also Google had all the control about this language.
Then, we can infer that the best option was Dart, followed by Kotlin.
Kotlin is more popular and it’s an official language for Android
Now a days, Kotlin has tools such Kotlin Multi-Platform (KMM) and Kotlin Native to avoid the JVM. Why Flutter is not rewritten in Kotlin?
Before this question we have to remember that there is a framework called Jetpack Compose in beta stage that was being under development since May 2017th.
Jetpack Compose (JC) is redefining the way to create Android Mobile Apps and the concept is very similar to Flutter but dialectically compatible with Kotlin.
In this moment JC is only working for Android while Flutter works for many platforms (mobile, web and desktop) due to Flutter is 3 years older than JC.
Both are good alternative, but Flutter is more mature.
Conclusions
After reviewing a few of history, Dart was the best choice for Flutter in the moment of the conception. This “issue” is not a really an issue, only a lack of knowledge about vital details to give an opinion. Dart was the best and probably the only one choice to create Flutter in 2014. Therefor I think it was a technical decision, not a Google’s whim.