Wednesday, October 15, 2014

Dart 1.7: easily share and use command-line applications built with Dart


The Dart language, libraries, and runtime make it easy to create command-line applications. In fact, all of the core tools in the Dart SDK – dart2js, pub, and dartanalyzer – are written in Dart. We wanted to allow developers to easily get their own Dart scripts and command-line apps into users' hands. With Dart 1.7, users now have an easy way to install and run scripts built with Dart, making first-class command-line Dart apps a reality.

Developers can specify executables (Dart scripts) in their pub package, which are made available to a user when the package is installed.

Before:

$> git clone https://git.example.com/my_cool_app
$> cd my_cool_app
$> pub install
$> dart bin/my_cool_app.dart

Now:

$> pub global activate my_cool_app
$> my_cool_app

Dart 1.7 also includes improvements to our code isolation models. You can now launch isolates with a different package root than the host application, allowing for composition of Dart applications with different dependencies. For more robust servers and long-running Dart scripts, developers cans now easily handle errors thrown in child zones.

We've also made it easier to install and upgrade Dart SDK and Dartium. We now support Apt on Linux and Homebrew on Mac.

For a summary of these and others changes see the release notes. You can download Dart 1.7 from the Download Dart page. If you are running the Dart Editor, you can update by checking "About Dart Editor". Check out the Dart support page for information on getting help, filing issues, contributing to the project.