Last week was really rich in official news from Dart. In this blog post, I will summarize the things that happened last week in Dartiverse and yes, lots of things happened! Are you prepared?
REST API with Dart
Dart team released RPC package for creating RESTful server-side Dart APIs. Yay! This package will help you with data serialization and routing of requests.Projects which are using RPC package at the moment are DartPad and TodoMVC, both are on Github. You can read how to use this package and download it either on pub or on Github.
Dart for the Entire Web
These were really important news for the community. Dart team decided not to integrate the Dart VM into Chrome and they are focusing on better compilation into the JavaScript. This makes sense to me because Chrome is not the only one browser on the entire world so the Dart application has to be always compiled into the JavaScript.And what do we want? Why we are using Dart? We want to be more productive, have the possibility to use great tools and libraries. And this is exactly what Dart brings to us, we are not losing anything from that. So for us, developers, there is no change. But imagine even better tools, server side and Dart on mobile. And these are exactly the things they are working on now.
I am really looking forward to the Dart summit because lots of these topics will be covered in Dart Summit speeches.
And finally. Google Ads is using Dart. With million lines of Dart code - this is great!
async, async*, await, yield...
These mysterious words deserve more attendance. They are really powerful because they make you more productive.Have you read this article about using async and await? No? Well, you really should. Take a look at this small example.
Instead of this:
HttpRequest.getString("animals.json") .then(feedAnimals);
you can now write this:
feedAnimals(await HttpRequest.getString("animals.json"));
But it is not now only about async and await. We have more power in our hands! async*, sync*, ... Take a look at the second article about new Dart language asynchrony support.
Dart 1.9
Dart 1.9 is probably one of the biggest releases after 1.0 and it was really worth waiting for. With 1.9 you can try the new Dart language asynchrony support and full support of enums.I can't also forget the awesome formatter, which is now integrated into dartfmt tool and that's not all. You can read more news about 1.9 in the release notes.
Soooo. Have you already tried async and await in your code?
Happy coding!