Dart And Other Programming Languages
I wasn’t new to Dart programming language and in the past year, I was writing Flutter apps with Dart.
I started writing Flutter apps with searches like “How to do X in flutter?” and “How to do Y in Dart?”. I never had a complete book or documentation about Dart or Flutter.
In my previous post, I said that for technical book of May, I chose “Dart apperentice” book. I finished reading the book and it is time to share what I’ve learned from this book.
What is Dart
Based on the definition on Dart’s website: “Dart is a client-optimized language for fast apps on any platform.”
Combining these two definitions gives us a good idea of the nature of this programming language.
It’s syntax is very similar to C and Java languages. If you are familiar with them, you won’t have problem reading and understanding programs in Dart. If you have familiar with Java, you will see lots of similarities here. Dart is object-oriented, class based, garbage collected programming language. It supports interfaces, abstract classes, inheritance, generics, enums and many other features that are very similar to Java. Dart is focused on writing client applications for Android, iOS, web, Windows, Linux and macOS. Currently, most of Dart developers are using this language to create applications with Flutter framework. It doesn’t mean that we can not use Dart for other purposes.
About Dart features
- Unlike Java, Dart has no primitive types and everything is Object in Dart.
- Dart is compiled to native code and has better performance than Java, Kotlin.
- Like Java and Kotlin, Dart is type-safe. Dart uses a combination of static type checking and runtime checks for type safety.
- Unlike Java, Dart does not support multi-threading.
- Dart has no fixed-size arrays. Just use the List data type wherever you would use an array.
- Dart has
dynamictyping. dynamic types are one of the dynamic inbuilt dart data types that can store any type of value, you can reassign with a different type than the declared type value. (for more on Dart dynamic type visit here.)
Here I want to make a little comparison between Dart and some other programming languages that I am familiar with. This is not a feature by feature comparison. This comparison is entirely based on my personal opinion.
Dart vs. Java
Dart syntax is similar to Java syntaxt, so it is quick and easy to learn. If you know Java, you can skip lots of topics when you try to learn Dart. Java is essentially build for server-side and Dart is build for client-side. They are belong to two different worlds. If you are an Android developer that is still using Java, Dart and Flutter are your best friends!
Dart vs. Kotlin
I think that Dart creators had an eye on Kotlin! kotlin was created to breathe new life into the old Java language. Darts is based on solid Java and take on a modern look from Kotlin. If you already know about Kotlin, you will see that it is very similar to kotlin in ideas and syntax. Kotlin and Dart are both multiplatform languages and share a very modern features and syntax.
We can continue these and compare Dart with other programming languages. I think that the best candidates would be C#, TypeScript and Swift.