Asynchronous programming is everywhere – user interaction, network access, file I/O. Dart simplifies and enhances these scenarios with the 1.9 release.
Today’s release introduces
async methods and
await expressions built on top of our existing
Future API. You can now use familiar control flow features –
if blocks, and
try/catch – to manage complex asynchronous interactions. These new features are explained thoroughly the Dart Language Asynchrony Support: Phase 1 article.
Future API makes it easier to compose asynchronous operations, but handling conditional cases and errors can still be difficult.
await make implementing the same functionality straightforward.
We are also introducing generator methods –
async* – that make it easy to lazily generate sequences, eliminating almost all cases where developers need to create custom iterators or manually manage stream creation. For more information, read the Asynchrony Support: Phase 2 article.
For a high-level overview of all of these new features, take a look at the Asynchrony section of the Dart Language Tour.
In addition to async, Dart 1.9 includes a number of other enhancements.
- enum, a long-requested feature, is now fully supported.
- The Dart Analyzer has moved to the Dart Analysis Server. This makes it much easier to integrate Dart source analysis into IDE’s beyond the Dart Editor (for instance, IntelliJ and Sublime).
- We've updated the regular expression engine for the Dart VM. It's up to 150x faster than the previous implementation.
- The Isolate API has now been fully implemented in the Dart VM, making it much easier to create applications that target multiple CPUs.
For a full list of the changes in this release, take a look at the release notes.