Photo by Miikka Luotio on Unsplash
The Dart programming language was first launched back in 2011 at a conference in Denmark. At that time, the Dart language was relatively small compared to other languages such as C#, JavaScript, or Python. But this changed with the release of Flutter.
Flutter was launched in 2018. It's often talked about as if it is a language on its own but Flutter is a UI library with a set of developer tools that helps developers build mobile apps using Dart. So the language of Flutter is Dart.
What is Dart used for?
Dart is used with Flutter to build mobile apps. This is one of the most common uses of Dart today. The big benefit of building apps with Dart and Flutter is that it is cross-platform. It means that you can build an app with just one code base instead of building two separate apps for iPhone and Android. The closest competitor to Flutter is React Native which is a cross-platform implementation of React.
There is yet no winner in the cross-plattform war between Flutter and React Native (perhaps there will never be). At the moment the React Native-community is much larger but Flutter is growing and taking market shares. Many developers say that Flutter provides a better developer experience (it's simply more nice to develop in). Apart from that, Flutter is slightly faster than React Native. Yet React Native has the big advantage that many companies already use React for their web apps and then React Native becomes the logical choice.
Dart is not limited to building the frontend for Flutter apps. You can use it on the backend as a server-side programming language too. Here is an example of a simple Dart HTTP server to server HTTP-request:
import 'dart:io';
main() async {
var server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 8080);
print("Serving at ${server.address}:${server.port}");
await for (var request in server) {
request.response
..headers.contentType = new ContentType("text", "plain", charset: "utf-8")
..write('Hello, world')
..close();
}
}
But it is far from as popular as other server-side languages such as PHP, Node or Python. It is probably not the best choice for a backend today because it has a small community. This means you have to build everything from scratch (instead of reusing libraries that someone else already built).