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 .

Breaking Change: Hashable interface is removed

Lasse Nielson writes to the Dart mailing list : Now that we have implemented hashCode on Object, we no longer need the  Hashable interface for anything. We have removed all references to Hashable in the SDK classes[1], and  will be removing the Hashable interface itself later - no earlier than in two weeks, but at some later point  it will be removed without further warning. The Hashable interface is still there, so classes that implement  Hashable won't break immediately. Code that *tests* whether an object is Hashable will probably begin  failing immediately! For example String is no longer Hashable. Two Dart M1 language changes converged to make this breaking change possible. First, explicit interfaces have been removed . Dart classes expose an implicit interface, so no need for explicit interface declarations. Second, Object now implements hashCode , so all objects explicitly are hashable. As always, you can join the discussion at that Dart mailing li...

Breaking Change: Raw string syntax

Matthias Hausner wrote to the Dart mailing list about an upcoming break change. Matthias writes: Tomorrow Thursday 9/27 we will eliminate support for the old raw string syntax that uses the @ prefix. The new syntax requires an r instead of the @ in front of the raw string literal. @"..."  ->  r"..." @'...' -> r'...' @"""..."""  ->  r"""...""" @'''...'''  ->  r'''...''' The Dart Editor (build 12784) can perform this change automatically. Time to update your code!

Use JavaScript code in your Dart apps

You can now use existing JavaScript code with Dart! We've recently released a JavaScript-Dart interop library , one of our developers' most requested features. This is a big milestone for the Dart project. Using this library, you can proxy JavaScript objects inside Dart code. You can also reach Dart functions from JavaScript code. Here's an example of wrapping a Google Maps API object: var canvas = query ( '#map_canvas' ); var googlemaps = js . context . google . maps ; var googlemap = new js . Proxy ( googlemaps . Map , canvas ); This code instantiates a JavaScript google.maps.Map object onto the given canvas and returns a proxy to Dart. Note that googlemaps.Map is a proxy to the JavaScript constructor. The resulting googlemap is a proxy to the actual Google Map object in JavaScript. Here's an example of calling a Dart function from JavaScript: js . context . handler = new js . Callback . once ( display ); var script = new...

Dart + HTML5 = Happy Web Developers

If you’ve been using HTML5 for a while, you’ve probably seen HTML5 Rocks . However, it’s not always clear how to translate these samples into Dart. To fix this, we’ve started a new project called dart-html5-samples , where we’ve started porting the HTML5 Rocks samples. We’ve already ported a bunch of tutorials such as: Reading Files in JavaScript Using the File APIs Native HTML5 Drag and Drop Exploring the Filesystem APIs HTML5 Video Getting Started with Web Audio API Introducing WebSockets: Bringing Sockets to the Web Using the Notifications API A Simple TODO list using HTML5 IndexedDB Leaner, Meaner, Faster Animations with requestAnimationFrame Along the way, we’ve occasionally encountered bugs in Dart. By filing these bugs on dartbug.com , we’ve not only been transparent about the process, but we've given the community a chance to vote for the features they find important. Although we’ve ported a lot of samples, many more remain. If you’d like to help out, thi...

Pub support in Editor

A new Dart Editor build is  available at  www.dartlang.org/editor . Changes include: Pub support in now on in the integration build! Features include: analysis support for the packages directories a pubspec.yaml editor, with syntax highlighting and other goodies our new app wizard can optionally create your app in a pub friendly format, including a sample pubspec.yaml file the 'pub install' and 'pub update' tools are available from the Tools menu the open folder dialog will run 'pub install' automatically if there is a pubspec.yaml In addition: The Eclipse plugins distro is now compatible with Eclipse 4.2. We now support using @override and @deprecated metadata from package:meta/meta.dart. See this  CL  for an example. Our syntax and semantic highlighting has been dialed back a bit. Added a clean up to migrate raw strings from @'str' to r'str'. Added a clean up to migrate parseInt() and parseDouble() references to...

3 Dart events at GOTO Conference

Next week, Dart is going to be at the  GOTO Conference  in Aarhus, Denmark!  We have three Dart events this year. Dart User Group and Code Lab After an introduction to the language, we'll guide you through all the steps to create your first Dart application. The code lab was battle tested in June during Google I/O, and is ready to go. We'll lead you through the process of building a modern web app with the Dart platform, using both client-side and server-side Dart. You will explore the language, libraries, editor, and integration with Chromium. You'll leave this session with a working Dart app that works in modern browsers. Register now! Translating Dart to efficient JavaScript To make Dart run in all modern browsers, we have implemented an optimizing Dart-to-JavaScript compiler. Performance-wise the biggest challenge is the gap between the semantics of Dart's low-level operators and JavaScript's builtin primitives. This presentation will intro...

Dart Language meeting notes from Sept 17

Bob Nystrom posted the latest Dart language meeting notes to the mailing list . Bob writes: Here's my notes from this weeks meeting: 0.11 language spec I asked when we'd be publishing the next version of the language spec. Gilad says "real soon now". We keep making changes so we don't want to publish just to immediately invalidate something a few days later. scope of type parameters Gilad brought up what happens if you try to access a type parameter within a static method: class Foo<T> {   static bar() => T; // <- What does this mean? } Currently they are just not in scope, which means it could refer to some other outer name. Instead, maybe we should say they are in scope, but you can't use them, which is consistent with other names inside a class. Kasper says there one's scope. It doesn't matter whether you are on the instance or static side. You'll just get an error if you try to refer to some...