Skip to content

Why I'm betting on Dart

Published:

8 min read

There’s been a lot of news about Flutter and Dart recently with the latest wave of Google layoffs1. The most extreme versions of the story paint a very bleak outlook for Dart and Flutter. Yet, I remain hopeful. In fact, I’m betting my livelihood on it at Celest, and couldn’t be more excited for the future.

Will Google kill Flutter?

Let’s quickly address the elephant in the room. Google does not have a good track record with their projects2. I’ve never worked for the company and can only speak to the public perception this creates, but it’s not pretty. And I hope to never operate my companies in the same way.

Some Google projects seem to face this existential question less often, though (e.g. Kubernetes, Android) and why Flutter is targeted more frequently perplexes me. Outwardly, Google demonstrates a consistent commitment to Flutter with their own apps, the latest being Google Classroom3. Geico recently announced4 that all new mobile projects will be written in Flutter. They join BMW, Toyota, eBay, and many other companies that continue to double down on the platform.

Over 1 million Flutter apps in production
There’s over 1,000,000 Flutter apps in production. Source: YouTube

These developments only strengthen my belief in its longevity. But outside of the apparent interest of Google and others, there’s not much we can decidedly say about its future, and attempting to understand the minds of Google VPs at this point is a task that’s best left to the divine.

Ian Hickson, Flutter’s tech lead, put it best I think in his latest blog post5 about the incident:

[…] I would love to see more direct contributions from non-Google sources, if for no other reason but to end this silly “will Google cancel Flutter” line of questioning that has followed the project since its inception. It’s a dumb question. Flutter’s an open source UI framework. It will never die.

I certainly empathize with this statement and have structured my career around supporting Flutter’s growth. So I don’t have much to add to the discourse, except for two points that I always seem to fall back on: Dart is an incredible technology; and Flutter is an inevitable one.

Her?

Dart and Flutter’s histories are so intertwined that it can be tricky to discuss them independently, but let’s try. I’ve noticed that when I speak with investors or potential customers—even those who know Flutter well—I often struggle to convey exactly what I mean when I say that I’m betting on Dart.

It’s an important distinction, I believe, no different than discussing JavaScript and React as two wholly separate entities. While Flutter is Dart’s main use case today, its history is incredibly rich and varied. It’s a language that has danced in many arenas over its 12-year life. And as a result, it’s picked up a very diverse and unique set of capabilities, one that I think is difficult to compare to in the modern software landscape.

The Dart programming language's origins
The timeline of Dart’s origin. Source: PDF
The timeline of modern Dart features
Recent Dart history. Source: Medium

Connecting the dots of Dart

I must outline the specific reasons why I feel so strongly about Dart, since my takes on the language can often come across as zealous or tribalistic. In reality, though, they’ve formed from simple patterns I’ve seen demonstrated repeatedly in the language and its evolution over many years.

1. Dart is a Google language, through and through

While this may read negatively given the intro, I mean it with regard, as if I had said it in 2013. Dart is the result of some of the smartest people in the PL, compiler, and VM worlds building a language that bakes in all the wisdom of their careers, the engineering culture of Google, and a mission to build cool technology that solves real problems. (Hot reload, anyone else? …anyone?)

My first exposure to Dart after Hello World was the official docs, and I was amazed (still am!) by the quality, thought, and care put into them. The codebases are no different, and the more I peel back the layers of Dart, the more I see this culture reflected in the language’s core design, implementation, and ecosystem altogether. It sets a high bar and makes me ashamed of my own coding standards at times (which I’m very grateful for!)

2. Dart is a uniquely versatile language

Dart began as a web language to challenge JavaScript in the browser (and was even standardized by the ECMA committee6). The Dart and Chrome teams built and shipped Dartium, a fork of Chromium that embedded the Dart VM inside and which allowed Dart to be dynamically loaded in webpages, no different than JavaScript today.

Luckily, that project was a flop—and not because I wouldn’t love to see Dart everywhere, but because it would have been a very different language than exists today. If Dart had become a browser language, it never would have gotten any of its most compelling features: strong, static types; sound null-safety; ahead-of-time compilation; and hot reload. (Or if it somehow did, they would have been rolled out over decades, not years.) Not being tied to the web has made Dart agile. Yet, the echoes of its origin still ring to this day.

When the Flutter project found its home in Dart, it began down a road with very different requirements. It added a JIT compiler with hot reload, then AOT, then WASM. It has evolved to be performant in all of these modes across a wide range of devices. Flutter has pushed Dart to become capable, and developers have pushed it to adopt modern conveniences like abstract data types, pattern matching, and newtypes.

The result is a language that can run basically everywhere and still keep up with larger languages when it comes to features and performance. Oh yeah, did I mention they did this all without LLVM?

The Dart compilers
Source: dart.dev

3. Dart is the ultimate interop-er

Most languages offer some form of foreign function calls to interface with C libraries. Dart does as well… but in addition, Dart supports native interop with Objective-C/Swift7, Java/Kotlin8, and JavaScript9.

All but the last one are just variations of C FFI, though the Dart team has been actively building code generators for these which make it feel like you’re just writing normal Dart code—a total boon. To boot, they’re close to shipping their native assets10 feature which will automatically bundle all these dependencies at build time into your Flutter app, Dart server, or CLI.

The most fascinating interop mechanism to me, though, is with JavaScript which, for statically-typed languages, poses a very interesting set of challenges. While Dart has always had some form of JavaScript interop, in the past it depended on dynamic dispatch and turning off some level of static type-safety. The latest iteration of this uses newtypes to achieve zero-cost type-safety on top of JS types11. The types are transparently compiled away at build time and work on WASM too!

The future of Dart

Dart started as a web language, failed, and moved on to mobile. From my perspective, this is where the story of Dart begins. While I believe the promise of cross-platform applications will continue to push Flutter and Dart forward, there remains a trove of untapped use cases for Dart (including perhaps a renaissance in the web.)

Being able to wrap over a Java package and Go library in the same language is a very compelling proposition. And in a future with even more languages and even more code written in not your favorite language, I believe what becomes most important is interoperability. And Dart has a story waiting to be told here.

In my daily work, I find it incredibly amusing and powerful that I can scaffold a Flutter app on macOS, run it on my Android phone and Chrome, code up some backend logic in the same folder, push it all to GitHub which runs CI using a custom GitHub action. Then a CLI tool talks to my control plane server to create a Docker image which is deployed to GCP.

And it’s all Dart!

Doubling down

Despite building a company around server-side Dart, I’m not convinced it will ever usurp JavaScript, Java, or Go on the backend. Too much code has been written in these languages, and the non-Flutter ecosystem is still very nascent in Dart. However, I see the sprawl of modern software continuing to accelerate in backend, infrastructure, and full-stack tooling. And as demand for software continues to grow in general, companies and developers are constantly seeking ways to do more with less. This is where I hope I can add to the story.

To me, Dart offers a truly unique programming environment that opens up a world of possibilities across the frontend and cloud. And it was only a matter of time before a language of its kind came along. If Flutter hadn’t given Dart a raison-d’etre, it’s true that Dart may not have survived and we may not be having this conversation today. Instead, we’d probably be discussing the hot new language Google just dropped called Dark that looks eerily similar. And while I’m sure Dark would have been a great language, I’m glad we have Dart. And I will continue to bet on it.

Footnotes

  1. https://news.ycombinator.com/item?id=40184763

  2. https://killedbygoogle.com/

  3. https://medium.com/flutter/cross-platform-development-with-flutter-how-google-classroom-gets-teachers-and-students-on-the-597d4f3b450c

  4. https://www.geico.com/techblog/flutter-as-the-multi-channel-ux-framework/

  5. https://ln.hixie.ch/?start=1714717681&count=1

  6. https://ecma-international.org/publications-and-standards/standards/ecma-408/

  7. https://dart.dev/interop/objective-c-interop

  8. https://dart.dev/interop/java-interop

  9. https://dart.dev/interop/js-interop

  10. https://github.com/dart-lang/sdk/issues/50565

  11. https://dart.dev/interop/js-interop/usage