Skip to main content

Posts

Showing posts from March, 2016

New site for Dart news and articles

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

The new AdWords UI uses Dart — we asked why

Google just announced a re-designed AdWords experience. In case you’re not familiar with AdWords: businesses use it to advertise on google.com and partner websites. Advertising makes up majority of Google’s revenue, so when Google decides to completely redo the customer-facing front end to it, it’s a big deal. The Dart team is proud to say that this new front end is built with Dart and Angular 2. Whenever you asked us whether Google is ‘even using Dart for anything,’ this is what we had in mind but couldn’t say aloud. Until now. We asked Joshy Joseph , the primary technical lead on the project, some questions. Joshy is focusing on things like infrastructure, application latency and development velocity, so he’s the right person to ask about Dart.   Q: What exactly did we launch on Monday? It’s a complete redesign of the AdWords customer experience that is rolling out slowly as a test to a small initial set of advertisers. The most noticeable thing is probably the Material Design look

Unboxing Packages: async Part 2

Two weeks ago , I introduced you to some of the marvels available for use in the async package. But that package is so big—there are so many marvels—that I couldn’t fit them all in. In fact, I only ended up writing about APIs that deal with futures and the individual values they represent. This week I’ll focus on the other major asynchronous type: Stream . I often find it useful to think of asynchronous types as analogous to synchronous ones, and by that metaphor if futures are individual values then streams are Iterable s. But in addition to representing asynchronously-computed collections of data, streams can represent things like UI events or communication (for example over a WebSocket ). Dart’s Stream class is very powerful. In addition to dispatching events, it allows the user to pause or cancel their subscription to the stream. What’s more, the creator of the stream can be notified of pauses or cancellations (or the initial subscriptions) and take appropriate action—like

Dart 1.15: Updated Dartium and improved live code analysis

Dart 1.15 is now available . This release includes important updates to our tools. Updated Dartium version Dartium has been updated from Chrome 39 to Chrome 45. While the underlying browser has been changed, there have been no changes  in this release to the corresponding APIs in dart:html, dart:svg, etc. We will roll out API updates in a future release to maximize stability and ease migration. Improved live code analysis The Dart analyzer service, used by WebStorm, IntelliJ, and Atom has been hardened in 1.15. Using error reports from Dart users within Google, we've been able to eliminate many common sources of instability. You should notice a much more reliable experience within your favorite Dart IDE. Release cadence changes Historically the Dart SDK has released a new stable release roughly every 2-3 months. The release duration has varied from release to release. Going forward we are going to attempt to ship on a more predictable schedule with a new release of

Unboxing Packages: async Part 1

Writing asynchronous code is hard . Even with Dart’s lovely async/await syntax, asynchrony inherently involves code running in a nondeterministic order, intermingled in a way that’s often difficult to understand and debug. Because there are so many possible ways to execute a program, and which one happens is so contingent on little details of timing, it’s not even possible to test asynchronous code in the same exhaustive way you might test something synchronous. This is why it’s so important to have abstractions and utilities that are simple and robust and can be used as building blocks for more complex programs. The core libraries provide the most fundamental abstractions: Future for an asynchronous value, and Stream for an asynchronous collection or signal. But it’s up to packages to build the next layer on top of those fundamental primitives. The async package is where the next-most-basic abstractions live. It’s a core library expansion pack that contains APIs that are just

Unboxing Packages: string_scanner

Parsing is tricky. There’s the high-level question of what parsing system you use—a parser generator ? A handwritten recursive descent ? Parser combinators ?—but there’s also the issue of how you move through text and track the information you need to track. That’s what the string_scanner package is for. The Core API The package exposes one main class, StringScanner , as well as a few subclasses we’ll get to later. This scanner moves through a string, consuming text that matches patterns and giving the user information about it. Here are the most important parts of the API: class StringScanner { Match get lastMatch ; int position ; StringScanner ( String string ); bool scan ( Pattern pattern ); bool matches ( Pattern pattern ); void expect ( Pattern pattern , { String name }); } Let’s walk through this, starting with position . This returns the scanners zero-based character position in the source string. The scanner always matches immedia