Skip to main content


Showing posts from 2017

Unboxing Packages: A Requiem for scheduled_test

Long long ago in the dawning days of Dart, when Futures were new and Streams unknown, Bob saw the need for a package manager to bring the people together. Together he and I spun formless bits into code and wove that code into pub, which even today carries code into the eager hands of Dartisans. In those olden days, we had no modern marvels such as the twins async and await, and our tests grew heavy and graceless under the weight of their chain()s1.So it was that I came up with an idea for a new way of writing tests. Instead of gluing the steps together with the cumbersome Future API, each step would register an asynchronous callback in a queue. Once all the steps were queued up, the library would run them in order. All the API boilerplate would be hidden away from the user, and the tests would look nice and clean. After honing this technique on pub’s tests, I brought it out into its own package, which I called scheduled_test.If this whole idea of queuing up tasks and running them late…

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, has started tagging Flutter plugins with …

What to expect at Google I/O 2017

Google I/O is happening in Mountain View this week. Here’s what you shouldn't miss if you're coming, or if you're following I/O from home.

Figure 1: One of the Flutter apps that will be live-coded on stage. You will also be able to build it in one of the codelabs.
Session: Prototyping to Production: Bridging the Gap with a Common Tool by Fiona Yeung and David YangFriday, 8:30am PDTDesign and engineering collaboration is difficult but vital for iterative user-centered product development. Join us (a designer and UI developer) as we use the Flutter UI framework to evolve a UI concept from prototype to production code. You'll leave this talk with a deeper understanding of how to bridge the gap between designers and UI developers through a prototyping-centric workflow, and why using a single framework between designers and developers helps your team work more efficiently.
Session: Single Codebase, Two Apps with Flutter and Firebase by Emily Shack and Emily FortunaFriday, 10:…

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.

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.23: Better strong mode support

Dart 1.23 is now available. It introduces support for overriding fields in strong mode and a lot of other improvements. Get it now!

Figure 1: Overriding fields in strong mode
We have been spending a lot of our time on our unified front-end (explained by Vyacheslav Egorov in this short talk from the Dart Developer Summit). We're also doing a lot of work to support our critical customers (for example, Flutter gets better Windows support with this release) and solidifying strong mode.

Some notable changes in this release:
Overriding fields is now supported in strong mode. You don’t need to tag them with @virtual anymore.Strong mode inference error messages are more helpful. Strong mode now prefers the expected type to infer generic types, functions, and methods.The UriData.parse method now normalizes and validates its input better.Importing dart:io is now allowed in the browser, as a stopgap measure to make it easier to write libraries that share code between platforms (like package ht…

Dart, Typescript and official languages at Google

Following Brad Green’s keynote at ng-conf 2017 that seemed to indicate that Typescript is now an official language at Google, there were many questions about the status of Dart at Google.

We would like to clarify that both Dart and Typescript are in the same category. They both are  allowed to be used for client side development. They are, however, not in the same category as more established languages like Javascript/Closure and Java — those have both more lines of code and more tooling.

Dart has been used for unrestricted client development at Google now for 4+ years. Dart and AngularDart are used by large products such as AdWords, AdSense and Shopping, and by critical internal tools such as Google CRM. In addition, the Flutter cross-platform mobile app framework uses Dart and is used by multiple teams at Google including Google CRM and Shopping Express. The Google codebase contains many millions of lines of Dart code.

Typescript has become allowed for unrestricted client developm…

Making a Dart web app offline-capable: 3 lines of code

Another article about Dart from Istvan Soos is about Progressive Web Apps, published today. — Filip Hracek

Have you ever tried to load a web application (maybe a game or a measurement converter) and couldn’t use it because the network was down? That’s an awful experience, but luckily we have the technology to make such apps available for our users.

For most apps and games, this can be done with 3 lines of Dart code and 1 command in the terminal. In this short article I’ll guide you through the steps, and make sure that you can always play Pop, Pop, Win!

Pop, Pop, Win! (code) — a Minesweeper implementation in Dart.
Service workersA service worker is a JavaScript file that runs in the background. It can control the web page or the site it is associated with, intercepting and modifying navigation and resource requests, and caching resources in a very granular fashion.

It is a non-intrusive web technology: service workers can improve the user experience if the browser supports them, but the…

From GWT to AngularDart: a case study with source code

Lots of interesting articles about Dart have been cropping up on lately. We've decided to cross post them here so that followers of this blog won't miss out on them. We'll start by Istvan Soos's GWT-to-Dart case study, published on Friday. — Filip Hracek

Earlier this year I was asked if there’s a good way to compare developing web UIs in Google Web Toolkit (GWT) vs. Dart, specifically AngularDart. Having worked with both GWT and Dart, I had a good idea of the differences, but as I thought more, I started to wonder how hard it would be to migrate a GWT application to AngularDart. This article describes what I’ve found while doing just that.

The GWT Mail Sample was an ideal place to start: it’s much more than a trivial example, with diverse features and complex UI interactions, yet it’s still manageable in size.

If you’re in a hurry, take a look at the working demo and the source code, or scroll to the bottom for the conclusions.

Screenshot of the demo.
The metho…

Dart 1.22: Faster tools, assert messages, covariant overrides

Dart 1.22 is now available. It introduces a sync/async union type, assert messages, covariant parameter overrides, and much more. Tool startup is now much faster. Get it now!

Faster tool startupWe have switched to using application snapshots for running our SDK tools like dart2js, analyzer, and pub. This improves startup performance. See the AOT compiling talk at Dart Dev Summit 2016 for more information. Information about how to use application snapshots can be found in the SDK wiki.

Here are the improved performance numbers we see with the switch.

Assert messagesThe fail-fast principle is crucial for building high-quality software, and assert is the simplest way to fail fast. But until now, it wasn’t possible to attach messages to asserts, so if you wanted to make your error useful, you were forced to throw a full exception. Like this:

num measureDistance(List waypoints) { if (waypoints.any((point) => point.isInaccessible)) { throw new ArgumentError('At least one waypoint …

Sound Dart and strong mode

As of the 1.19 release, Dart supports an optional mode, called strong mode, that supports stronger static typing. Strong mode helps you find bugs sooner and contributes to making Dart a sound language.

To learn more about using strong mode to enable soundness, including the how, the why, and fixes for common problems you might encounter, see:
Sound Dart
How and why to write sound Dart code, and how to use strong mode to enable soundness.Sound Dart: FAQ
A list of common questions for those who are interested in stronger static typing.Sound Dart: Fixing Common Problems
How to fix errors and warnings you may encounter when writing sound Dart code.

Dart in 2016: The fastest growing programming language at Google, 2nd fastest growing in TIOBE Index

Dart was the fastest growing programming language at Google in 2016 with millions of lines of code written. It also made it to TIOBE Index Top 20 this month (see TIOBE's methodology).

It takes time to build something as ambitious as Dart and, in some ways, Dart is still in its infancy. But we're glad the hard work is starting to pay off.

Many thanks to our amazing community!

We're going to celebrate by ... releasing 1.22 next week (as per our usual 6 week release schedule).