Dart: Two Years In

In February of 2014, I met some Google employees at the Digital Signage Expo who were extolling the virtues of ChromeOS. I asked about how I would go about moving our Adobe AIR and Flash based product to Chrome’s ecosystem, and they gently asked: “Have you heard of Dart?”

Now, it’s been two years since I started programming in Dart in earnest. It started as an experiment, and now it’s become integral to everything I create.

Language Feature: Futures

The concept of Futures took me a while to understand. A Dart function can return simple objects like a String or a Boolean, but it can also return a ‘Future’. That Future is like a promise that you’ll get a result (of type String or Boolean or whatever) later, so you can drop it in a handler function whenever it arrives. Understanding the concept isn’t so bad – it’s not unlike using callback function – but the code will get messy if you aren’t careful.

Now that I’ve got a handle on it, it’s a fantastic tool for code that depends on actions that may not all happen when you expect them too – like dealing with client-server interactions. And a group of Futures can be condensed into a Stream object. A Stream is just an iterable list of Futures, like a List (sometimes called Array or Collection) is just an iterable list of variables. This handy chart did more for my understanding of this concept than words, so here it is:

Single Variable Iterable Variables
AsYNCHRONOUS Future Stream

Language Feature: Inline asynchronous code

Coding with Futures and Streams can get messy. Bug-free code can become very difficult for a human to read, since variables get shuttled from one function to the next, some inline, some in other classes. The keywords async and await solve all of that.

Using just a Future (or callbacks in other languages), the code reads: “Ask for a String and when it comes back handle it with this function”

Using await, the code reads: “Ask for a String. I’ll wait for it.”

It’s far more legible (to me, anyway). I can write a huge function that loops in and out of a servers database without nested functions or callbacks. Instead, I just pause the code until the database call or server call is completed, and proceed all inline. This has made everything easier to code, read, understand and debug. I can’t recommend it highly enough. Here’s further reading.

Community Support

A strong community makes or breaks technology, and Dart has a fantastic community led by Google employees. Whenever I have a question, comment or complaint, someone with an @google email address is the first to respond. The only bug I’ve filed in two years was quickly explained and handled. And Google hosts and streams Dart summits (for free!) to promote their language.

They talk the talk, but they also walk the walk. The new Google AdWords user interface is built in Dart. AdWords represents the majority of the revenue in the company ($66 billion in 2014), eclipsing everything else. Betting that bank on Dart? Yeah – Dart will have community support for a while yet.

This should also answer your ‘is it production ready?’ question. Yes. It is.


There are a few things that might make Dart not right for your project. For starters, there’s no out-of-the-box CMS built for Dart. Some of the most famous JavaScript libraries (Greensock, for example) don’t have Dart equivalents. You can integrate existing JavaScript into Dart projects, but the process can be annoying and difficult to debug. For smaller JS libraries, it might be worth re-writing them in Dart, but for the big stuff, switching technologies like that is a major commitment.

But those are all problems we might not be talking about by the end of this year. Dart is being furiously developed internally at Google, and Dart developers are reaping the benefits.

I’m two years in. I can easily see myself going another two years.

Come along for the ride.

Leave a Reply

Your email address will not be published. Required fields are marked *