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 .

Unboxing Packages: source_span

One of the best aspects of a package ecosystem is its ability to foster language-wide conventions without direct involvement from the SDK. Packages work together and build on one another to create something more than any of them could be on their own. The glue that holds this structure together is made of little packages that establish these conventions, that provide a shared language for the ecosystem as a whole to use. One of these glue packages that I find most useful is source_span . This package began its life as part of the more specialized source_maps package, it quickly became clear that the idea of referring to chunks of code was much more broadly applicable. I factored it out, tweaked the API to make it more general, and over time added a few additional features. The result is the package I’ll talk about today. The basic idea underlying source_span is that there should be a straightforward and consistent way for packages to refer to spans of text. This is useful for ass...

Dart 1.14 continues to improve core APIs and tools

Dart 1.14 is now available . This release contains a number of additions and improvements across our core libraries and our tools. Progress towards eliminating symbolic links Symbolic links for package resources can cause problems, especially on Windows. Since Dart 1.12, we’ve been working to support a Package Configuration File . The goal of this work is to provide a better model for package access. Dart 1.14 contains new APIs in both dart:io and dart:isolate to provide code access to the configuration file if it’s being used. You should consider these APIs experimental as we update the test package and pub to validate the implementation. Access package assets easily and reliably Developers frequently need to directly access assets within packages. In the past this has lead to confusion when supporting the many ways in which a Dart program can be executed. Along with the new Package Configuration APIs added in Dart 1.14, we’ve also released a resource package . This packa...

Unboxing Packages: collection

I often find myself working with a class of Dart packages I like to think of as core library expansion packs . They aren’t the splashiest, they don’t produce cool demos, but they’re extremely useful. These expansion packages, which are always named after a dart: library, build upon that library’s design and functionality to provide utility classes and fill in missing features. Actual core libraries—the things you get when you write import "dart:..." —are very useful because they’re always there, but they’re also really painful to change. Exactly because they’re always there, they have much stronger stability guarantees than the rest of the ecosystem. It’s dangerous to even add a new class because it might conflict with a user’s class name and break existing code. And forget about adding an instance method. What if someone was implementing that class as an interface? For those reasons, the core libraries are kept as slim as possible. So what happens when we want to add a ...

Unboxing Packages: stack_trace

Editor's note: This is the first post in a new series by Natalie going in-depth on Dart packages and how they're used. If you’ve written any Dart code at all, you’ve definitely used tools that use the stack_trace package . It was originally written for use in pub, and the test package uses it for all the stack traces that tests generate. But you don’t just have to rely on other tools to use it for you—you can use it yourself! The package has three main use-cases, all of which are important and useful. Originally, it was just designed to make existing stack traces prettier and easier to read. A big part of that was parsing stack traces into a data structure, so its secondary purpose became programmatically manipulating stack traces. Then once zones were created, it added support for tracking stacks across asynchronous calls. Making Traces Pretty Let’s face it: the Dart VM’s built-in stack traces aren’t nice to look at, and they don’t present information in a way that’...

How Google Uses Angular 2 with Dart

Cross-post from the Angular blog. Google is always busy building new web apps, and recently a lot of that development is using Angular 2 for Dart . Just last week, the Google Fiber team launched Google’s first production Angular 2 app, written in Dart. Take a look at their just-launched Angular 2 for Dart app: The Fiber team has lots of company within Google—Angular 2 for Dart is being quickly adopted by many other Google teams. Dart is an open-source development platform from Google that makes web and mobile development more productive. The Dart language is a concise yet expressive language that’s familiar to developers coming from Java, C#, ActionScript, and JavaScript. The Dart platform gives you an instant edit-debug cycle, great core libraries, a canonical package manager, a powerful semantic analyzer, and IDE support via IntelliJ IDEA and WebStorm. You can run Dart code compiled to JavaScript on all modern browsers. We’ve worked closely with the Angular team as...

Dart 1.13 brings improved JavaScript interoperability and more

Dart 1.13 is now available . With this release, you can more easily access JavaScript APIs from Dart code. We've also improved secure networking on the server. Easier JavaScript interoperability Dart 1.13 provides a new syntax for creating Dart API facades for existing JavaScript libraries. Facades have the benefits you expect from a Dart library: errors, warnings, and code navigation. They also provide the Dart-to-JavaScript compiler the structure needed to provide interoperability with low code size and runtime cost. Example facade for Chart.js library Use the js package to create Dart APIs for your favorite JavaScript libraries. We have an example port of the Chart.js library if you'd like to see how to use these new features in your code. Graph generated with Chart.js and Dart We're actively working on tools to generate JS facades from other typed-JavaScript implementations. To track progress, subscribe to this GitHub issue . Improved secure netwo...

Highlights from the TC52 meeting on September 21, 2015

Last month we had the 9th TC52 meeting where we discussed a number of additional language features for Dart. Below is a list of the main features discussed - most noticeably the lifting of restrictions on mixins. DEP update There is a rich supply of Dart Enhancement Proposals under consideration, and we spent some time discussing the underlying ideas and motivations for several DEPs. Language extensions and modifications under consideration Several language extensions and modifications are currently being considered in more concrete terms. Generic methods This is the most complicated DEP, in particular with respect to reification of the type arguments and other typing issues. Since the previous meeting work has been conducted on prototyping features relating to this DEP, and the impact on libraries has been explored. Among the big concerns are compatibility and implementation efforts. This might not materialize before 2016. Constant context, constant functions One DEP is ...