Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

Dart 2.2 is out with support for set literals and more!

Save for later
  • 2 min read
  • 27 Feb 2019

article-image

Michael Thomsen, the Project Manager for Dart announced the stable release of the general purpose programming language, Dart 2.2. This version, which is an incremental update to v2, offers improved performance of ahead-of-time (AOT) compiled native code and a new set literal language feature.

Improvements in Dart 2.2

Improved AOT performance


Developers have worked on improving the AOT performance by 11–16% on microbenchmarks (at the cost of a ~1% increase in code size). Prior to this optimization, developers had to make several lookups to an object pool to determine the destination address. However, the optimized AOT code is now able to call the destination directly using a PC-relative call.

Extended Literals to support sets


Dart supported the literal syntax only for Lists and Maps, which caused difficulties in initializing Sets as it had to be initialized via a list as follows:

Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at €18.99/month. Cancel anytime
Set<String> currencies = Set.of(['EUR', 'USD', 'JPY']);


This code proved to be inefficient due to the lack of literal support and also made currencies a compile-time constant.

With Dart 2.2’s extension of literals to support sets, users can initialize a set and make it const using a convenient new syntax:

const Set<String> currencies = {'EUR', 'USD', 'JPY'};

Updated Dart language Specification


Dart 2.2 includes the up-to-date ‘Dart language specification’ with the spec source moved to a new language repository. Developers have also added continuous integration to ensure a rolling draft specification is generated in PDF format as and when the specification for future versions of the Dart language evolves. Both the 2.2 version and rolling Dart 2.x specifications are available on the Dart specification page.

To know more about this announcement in detail, visit Michael Thomsen’s blog on Medium.

Google Dart 2.1 released with improved performance and usability

Google’s Dart hits version 2.0 with major changes for developers

Is Dart programming dead already?