Skip to main content

Posts

New site for Dart news and articles

For the latest Dart news, visit our new blog at  https://medium.com/dartlang .

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 workers A 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 suppor...

From GWT to AngularDart: a case study with source code

Lots of interesting articles about Dart have been cropping up on Medium.com 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 o...

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 startup We 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 messages The 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 Ar...

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).

Enhancing the Flutter developer experience

At the Dart Developer Summit we introduced our fast and powerful Flutter developer experience. But our ambitions don’t stop here, so we have been hard at work developing several updates that further improve the experience. Faster startup during development Hot reload means you only have to launch your app once; after that changes are simply reloaded into the running app. But even that initial launch should be really fast. Previously we used a loader application to bootstrap the device with your application sources. Thanks to recent improvements made to the reload engine inside the VM this is no longer necessary and your application will be booted immediately, and you will see the real launch experience of your app. IntelliJ improvements We have published an update to our IntelliJ plugin, version 0.1.6 that has several exciting changes : Launching the app with hot reload support (see details below) A new flutter action pane has been added on flutter.yaml files (see de...

Dart 1.21: Generic Method Syntax

Dart 1.21 is now available. It introduces support for generic method syntax along with a few popular convenience features. Get it now! Generic method syntax Until now, Dart's generic support was limited to classes, such as List<T> . Dart 1.21 introduces syntax allowing type arguments on methods and functions.    T first<T>(List<T> ts) {      return ts.length == 0 ? throw new ArgumentError('Empty list!') : ts[0];    } Note the return type, T . This enables call sites to preserve type information from arguments. Try to write the same function without a type argument, and you'll see that the return type must be Object – there is no other way we can make it work on all lists. For more examples, check out the Using Generic Methods article . For even more details, the informal specification is the place to go. We've had generic methods and functions for a while in strong mode . 1.21 introduces support for generic method s...