Dart 2 marks the rebirth of the programming language powering Flutter
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.
Dart on the web
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:
- a package manager that works with their package site,
- a static analyzer,
- a linter that you can consume from the command line or as a package, and
- tooling for web documentation and code formatting that conforms with the Dart style guide.
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.