Skip to main content

Dart 2.0 pre-releases: What they mean to you

If you publish Dart packages or like to use early releases of the Dart SDK, the next few months are going to be interesting, as apps and packages adapt to the changes required by Dart 2.0. To make the process smoother, the pub tool that’s in Dart 2.0 pre-releases allows developers to download (and attempt to use) packages that don’t explicitly support Dart 2.0.

The upshot:

  • Use a stable Dart SDK if you need reliability.
  • Use a pre-release Dart 2.0 SDK if you’d like to test published packages with Dart 2.0. Report any issues you find to the package maintainer.
  • If you publish packages, be careful about SDK constraints, and expect feedback from developers trying your packages with Dart 2.0.

The Dart 2.0 update page has all the details, but here’s an overview of what to expect, based on your development environment and the kind of code you write.

If you use Flutter: In the short term, your Flutter code isn’t affected. When Flutter updates its Dart SDK to a Dart 2.0 pre-release, the Flutter team will tell you how to manage your dependencies.

If you use a stable Dart SDK: When running pub upgrade, you might notice that you aren’t getting the latest releases of some packages. This might happen because the packages have versions that require a Dart 2.0 feature. Consider checking the release notes of critical packages to see whether the packages have important fixes or new features.

If you use a dev channel Dart SDK: When running pub get, pub upgrade, or other pub commands from a 2.0 pre-release, you might get packages that haven’t been verified to work with 2.0. If you find a package that has 2.0 issues, please report those issues immediately to the package maintainer, and let the Dart community know about any workarounds you find.

If you publish packages: Don’t change your already-published packages just to add SDK constraints to the pubspec. If you do need to change a package, try to make your changes backward compatible with Dart 1.x. Before publishing a package, make sure that the pubspec has correct lower and upper SDK constraints. Use <2.0.0 as the upper constraint, for now. Examples:

# Works in 1.20.1+; might work in 2.0.0-dev:
sdk: '>=1.20.1 <2.0.0'       

# Backward incompatible change requires at least 2.0.0-dev.1.2:
sdk: '>=2.0.0-dev.1.2 <2.0.0'

For more information about how to adapt your code for Dart 2.0, see the Dart 2.0 update page.

Popular posts from this blog

A stronger Dart for everyone

We are constantly asking ourselves:
How do we make developers even more productive when writing Dart apps? We believe that a critical part of the answer to this question is to make strongmode – a sound static type system for Dart – the standard for all Dart developers.

Teams that use Dart to build apps like Soundtrap, AdWords, AdSense, and Greentea say they really enjoy using strong mode features, such as early error detection. In fact, teams that have switched completely to strong mode cite not only early error detection but also better code readability and maintainability as major benefits. We hear this both from small teams and Рeven more so Рfrom large teams with hundreds of developers writing and maintaining millions of lines of Dart code. As Björn Sperber from Soundtrap says,
Strong mode and the smooth integration with IntelliJ is a joy to use and a huge improvement. If you’ve tried out Flutter, you’ve already used strong mode checks from the Dart analyzer.

Given the benefits …

AngularDart 3.0: Easy upgrade, better performance

AngularDart 3.0 is now available. It brings better performance and smaller generated code, while also making you more productive.


Version 3.0 is an evolution: although it has some breaking changes (detailed below), it is a smooth upgrade due to minimal public API adjustments. Most of the progress is under the hood—in code quality, stability, generated code size, performance, and developer experience.

Code quality:
2731 instances of making the framework code more type safe (using sound Dart).The AngularDart framework code size is down by 12%.Many additional style updates to the codebase:Changed to use idiomatic <T> for generic methods.Removed NgZoneImpl, all the code exists in NgZone now.Stability:
Many CSS encapsulation fixes due to update with csslib package.Fixed bugs with IE11.

Performance:
For the Mail sample app, we see 30% faster time-to-interactive (currently 3812 ms on a simulated 3G connection, measured via Lighthouse).Our large app benchmark shows 2x faster render times of…

Dart 1.24: Faster edit-refresh cycle on the web & new function type syntax

Dart 1.24 is now available. It includes the Dart Development Compiler and supports a new generic function type syntax. Get it now!


Figure 1: DDC debugging in Chrome.

Some notable changes in this release:
pub serve now has support for the Dart Development Compiler. Unlike dart2js, this new compiler is modular, which allows pub to do incremental re-builds for pub serve.In practice what that means is you can edit your Dart files, refresh in Chrome (or other supported browsers), and see your edits almost immediately. This is because pub is only recompiling your package, not all packages that you depend on.There is one caveat with the new compiler, which is that your package and your dependencies must all be strong mode clean.You can also use the new compiler to run your tests in Chrome much more quickly than you can with dart2js.Read more in the changelog.You can now publish packages that depend on the Flutter SDK to pub. Moreover, pub.dartlang.org has started tagging Flutter plugins with …