The stable release has landed!

Dart 2 marks the rebirth of the programming language powering Flutter

Gabriela Motroc
Dart 2
© Shutterstock / Koyjira

We first mentioned the arrival of Dart 2 last summer when David Morgan, software engineer at Google revealed that when the stable release arrives, strong mode will just be “the type system”. The wait is over: Dart 2.0 is here! Let’s have a look at all the shiny new features.

David Morgan, software engineer at Google revealed last year that when the highly-anticipated Dart 2.0 arrives, strong mode will just be “the type system”. The wait is over: Dart 2 is here and it’s determined to make this programming language great (again?!).

The goals of this release are to:

  • strengthen and tighten the language,
  • develop the support for web and mobile frameworks, and
  • bring some of the tooling and components that support Google’s usage of Dart to the outside world

Dart 2 highlights

Kevin Moore, Product Manager at Google, announced in a recent blog post that the latest release marks an important milestone towards the stable release of Flutter. The first Release Preview of Google’s open-source mobile application framework was announced at the GMTC Global Front-End Conference in late June, which signaled a new phase of development for Flutter.

If you’re a Flutter developer, chances are you’ve already dipped your toes into Dart 2 but enough about Flutter. 

A client-optimized language

The fact that Dart 2 is something of a major reboot for the language is nothing new; Google’s Anders Thorhauge Sandholm highlighted this in a blog post earlier this year.

The Dart type system is sound, which means that “a large class of issues is found before your users run your application — during analysis and compilation,” Moore explained. As the team scaled Dart to very large apps within Google, the type system caught more errors early in the development cycle, which led to higher quality production code. One of Dart 2’s benefits is that the scenario in which you’ll get into a state where an expression evaluates to a value that doesn’t match the expression’s static type is no longer possible. You’ll be able to “scale your codebase to millions of lines, tackle large refactoring projects, and deploy your code with confidence,” he added.

Don’t worry: soundness doesn’t mean mountains of boilerplate. The type system includes advanced inference — even for generic type arguments.

SEE ALSO: GitHub Trending: The community is interested in Flutter, Xray, TensorFlow & Vue.js

Dart on the web

You might already be familiar with AngularDart, which was first announced in July 2016. The fifth version is shipped as part of Dart 2 and it puts Dart’s sound type system and the new build system to good use in the sense that it offers fast incremental builds during development and smaller compiled JavaScript when you’re ready to deploy.

Flexible tooling

We mentioned that Dart 2 is something of a major reboot for the language; speaking of big changes, thanks to Dart 2, this language is now a first-class compiled-to-JavaScript language, “with a dev cycle that web developers expect and excellent runtime performance characteristics. This is done while providing benefits most JS-targeted languages don’t provide: a sound type system and excellent support for native mobile apps.”

With Dart 2, our web tools embrace a 100% JavaScript development model with two complementary JavaScript compilers. The development compiler,dartdevc, provides fast incremental compilation while generating JavaScript that is easy to read and debug. This allows our production compiler, dart2js, to focus on producing highly optimized JavaScript for progressive web apps for mobile and complex enterprise experiences for the desktop. Both compilers leverage Dart’s sound type system to optimize their output.

Moreover, the language now supports  Visual Studio Code with the Dart Code extension – in addition to  support for Android Studio and the JetBrains suite of tools, including IntelliJ IDEA and WebStorm. Plus, you can now experiment with DartPad, which has been fully updated for Dart 2.

Last but not least, the Dart SDK arrives with some useful tools in tow, such as:

Read more about Dart 2 here and don’t forget to check out the release notes, which offer a detailed technical breakdown of all the smaller improvements made since Dart 1, some of which are breaking changes for older Dart code. 

Gabriela Motroc
Gabriela Motroc was editor of and JAX Magazine. Before working at Software & Support Media Group, she studied International Communication Management at the Hague University of Applied Sciences.

Inline Feedbacks
View all comments