Version 2.15 of the Dart SDK is released
(8 December 2021)

Other recent news...

Google Announces Flutter for Windows
Flutter 2.10 enables the development of high-quality Windows apps that also run as native apps on Android and iOS devices as well as web platforms - all from the same codebase!
4 February 2022
Docker supporting COVID-19 genomic monitoring
The efficient nature of Docker containerisation has transformed how public health disease monitoring is performed and grown the scale of the viral monitoring effort.
26 January 2022
Google launches new Bumblebee version of Android Studio
Android Studio is the officially supported IDE for developing Android apps and building app packages for installation on Android devices.
25 January 2022
Version 2.15 of the Dart SDK is released
Today Google released version 2.15 of the Dart SDK, featuring fast concurrency with worker isolates, a new constructor tear-off language feature, improved enum support in the dart:core library, new features for package publishers, and more.

Dart is a programming language developed by Google for developing fast apps on any platform. Its goal is to offer the most productive programming language for multi-platform development, paired with a flexible execution runtime platform for app frameworks.

Dart is particularly suited to client development, prioritizing both development and high-quality production experiences across a wide variety of compilation targets (web, mobile, and desktop).

Dart also forms the foundation of Flutter. Dart provides the language and runtimes that power Flutter apps, but Dart also supports many core developer tasks like formatting, analyzing, and testing code.

The Dart language is type safe; it uses static type checking to ensure that a variable’s value always matches the variable’s static type. Sometimes, this is referred to as sound typing. Although types are mandatory, type annotations are optional because of type inference. The Dart typing system is also flexible, allowing the use of a dynamic type combined with runtime checks, which can be useful during experimentation or for code that needs to be especially dynamic.

Dart offers sound null safety, meaning that values can’t be null unless you say they can be. With sound null safety, Dart can protect you from null exceptions at runtime through static code analysis. Unlike many other null-safe languages, when Dart determines that a variable is non-nullable, that variable is always non-nullable. If you inspect your running code in the debugger, you’ll see that non-nullability is retained at runtime (hence sound null safety).

Fast concurrency with worker isolates
Just about all modern devices have CPUs with multiple cores, capable of running multiple tasks in parallel. For most Dart programs, how these cores are used is transparent to you as a developer: the Dart runtime system by default runs all your Dart code on a single core, but then uses additional cores for executing systems-level tasks such as async input/output, like writing a file or making a network call.

But your Dart code itself may need to run concurrently. For example, you may have a continuous animation and a long-running task such as parsing a large JSON file. If the additional task takes too long, that might cause stutter or lag in the UI. By moving those additional tasks to a separate core, the animation can continue to run on the main thread of execution, uninterrupted.

Dart’s model for concurrency is based on isolates — independent units of execution that are isolated from one another — to prevent a large class of concurrency programming bugs related to shared memory, such as race conditions like data races. Dart prevents these bugs by not allowing any mutable objects to be shared between isolates, and instead uses a model where isolates exchange state using message passing. In Dart 2.15 we’ve made a number of substantial enhancements to isolates.

New language feature: Constructor tear-offs
In Dart you can create a function object, which points to a function on another object, by using the function’s name. Such function pointers — also referred to as function tear-offs — appear frequently when using the Dart core libraries.

Improved enums in the dart:core library
We’ve made a number of convenience additions to the enum APIs in the dart:core library (language issue #1511). You can now get the String value for each enum value using .name

Compressed pointers
Dart 2.15 adds support for compressed pointers, a technique where a 64-bit SDK can use a more space-efficient representation of pointers if only a 32-bit address space needs to be supported (up to 4 GB of memory). Compressed pointers result in a significant memory reduction; in our internal testing with the GPay app, we saw an approximately 10% reduction of the Dart heap size.

Because compressed pointers imply not being able to address any available RAM above 4 GB, the feature is behind a configuration option in the Dart SDK that can only be toggled by embedders of the Dart SDK when the SDK is built. The Flutter SDK version 2.8 has enabled this configuration for Android builds, and the Flutter team is considering also enabling it for iOS builds in a future release.

Dart DevTools included in the Dart SDK
The DevTools suite of debugging and performance tools previously wasn’t in the Dart SDK; you had to download it separately. Starting with Dart 2.15, you now get DevTools when you download the Dart SDK, with no further installation steps required. For more information on using DevTools with Dart command-line apps, see the DevTools documentation.

New pub features for package publishers
Dart 2.15 SDK also has two new features in the dart pub developer command and the pub.dev package repository. First, there’s a new security feature for package publishers. The aim is to detect when a publisher accidentally publishes secrets — for example Cloud or CI credentials — inside pub packages. We were inspired to add this leak detection after learning that inside GitHub repositories, thousands of secrets are leaked every day.

Leak detection runs as part of the pre-publish validation run in the dart pub publish command. If it detects a potential secret in the files about to be published, the publish command exits without publishing, and prints a warning message.

more news...