Google has announced the latest release of its programming language Dart. Version 2.6 comes with dart2native, an extension of its existing compiler with the ability to compile Dart programs to self-contained executables containing ahead-of-time compiled machine code.

According to the company, this will enable developers to create tools for the command line on macOS, Windows or Linux using Dart, which was previously only available for iOS and Android mobile devices.

The self-contained executables can run on machines that don’t have the Dart SDK installed and can start running in just a few milliseconds. Meanwhile, the same set of core libraries are available in Dart when compiling to native code, Google explained.

The updated version also includes interoperability with C code via ‘dart:ffi’; and it kilo, a 7MB code editor written in less than 500 lines of Dart code.

“By compiling your service’s code ahead-of-time to native code, you can avoid this latency and begin running right away. In addition, with native code you can create Dart services that have a small disk footprint and are self-contained, greatly reducing the size of the container in which the Dart service runs,” the Dart team wrote in a blog post

According to Dart developer Paul Mundt, he was able to reduce the size of his Docker image by more than 90% by using native code. 

This initial version of the dart2native compiler has a few known limitations including no cross-compilation support, meaning that the compiler creates machine code only for the operating system that it’s running on; no signing support; and no support for ‘dart:mirrors’ and ‘dart:developer.’

The Dart team also said that the updated version contains a preview of an extension methods language feature, which the team said will be polished in the next SDK version.