Skip to main content

Posts

Showing posts from 2015

New site for Dart news and articles

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

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

Dart adopts BoringSSL

Starting today, with the 1.13.0-dev.1.0 release of the Dart SDK, the Dart VM has upgraded its TLS/SSL implementation to BoringSSL . The BoringSSL library is a fork of OpenSSL that’s created and maintained by Google. Dart developers now have the same implementation of SSL as Chromium and Chrome. The new implementation includes some breaking changes to the SecureSocket class and related classes. Dart programs that create secure servers will need to provide their server certificate chain and private key in a new, and easier, way. We encourage you to try the dev channel build of Dart SDK and the new configurations for BoringSSL. You can learn more about Dart and TLS/SSL , and we look forward to your feedback . --- Bill Hesse, feeling more secure

Dart 1.12 Released, with Null-Aware Operators and more

Dart 1.12.0 is now released ! It contains the new null-aware operators language feature, and enhancements to pub, Observatory, dartdoc, and much more. Null-aware operators The new null-aware operators help you reduce the amount of code required to work with references that are potentially null. This feature is a collection of syntactic sugar for traversing (potentially null) object calls, conditionally setting a variable, and evaluating two (potentially null) expressions. Click or tap the red Run button below to see them in action. ??   if null operator. `expr1 ?? expr2` evaluates to `expr1` if not `null`, otherwise `expr2`. ??=   null-aware assignment. `v ??= expr` causes `v` to be assigned `expr` only if `v` is `null`. x?.p   null-aware access. `x?.p` evaluates to `x.p` if `x` is not `null`, otherwise evaluates to `null`. x?.m()      null-aware method invocation. `x?.m()` invokes `m` only if `x` is not `null`. Learn more about Dart's null-aware o

A New Way to Share with DartPad

Back in May, we announced the release of DartPad 1.0 , a clean and zero-install tool that helps you explore Dart . To create a seamless learning experience for both experienced and new developers, today we released embeddable pads! You can now add live Dart code to web pages. Embeddable pads have the full power of the standalone DartPad: Tutorials and guides can use embeddings to quickly demonstrate concepts on the fly: You can also open embedded pads in DartPad to further edit and share code. For more information, view the embedding guide . Head over to dartpad.dartlang.org and share your first pad! We hope you enjoy this new addition and provide us with feedback—remember, sharing is caring! Posted by George He, Chief Sharing Operator

5% smaller output from dart2js

dart2js now produces up to 5% smaller output in the latest dev channel release of the Dart SDK. We measured a 5% reduction on the minified and zipped dart2js output for one of the larger Dart-based apps in Google with source code size around 17MB. While we’ve seen a 5% reduction on a large app, your milage may vary and improvements are expected to increase with the size of your app. This improvement comes on top of a previous 3% reduction since the beginning of this year. The idea behind the latest improvement is quite simple: The symbols that will occur most often in the generated output should be assigned the shortest minified names. So when minifying the code, we rename according to the frequency of each symbol in such a way that a high frequency results in a short name in the output. This new frequency-based namer generally produces smaller output, which is great for deployment. It does however also result in different name allocations and thus “diffing” before/after the c

Null-aware operators and generalized tear-offs in Dart

Yesterday, on June 17, 2015, the 109th Ecma General Assembly approved the ECMA-408 3rd edition - Dart Programming Language Specification . Main additions to the 3rd edition of the spec are null-aware operators and  generalized tear-offs .  Null-aware operators are currently being implemented and tear-offs will follow. The standard has been published on the Ecma Website.

Dart is now on GitHub

Dart is an open-source programming language, with contributors working on the language, libraries, tools, and packages. To make working with our community even easier, today we are announcing that we've fully settled into our new home on GitHub. We invite you to follow along and contribute at https://github.com/dart-lang . The Dart SDK now has its own repository , joining the numerous Dart tools and packages already in our GitHub org . We’ve moved all the SDK issues over (keeping the original issue numbers!), and dartbug.com now points to GitHub's issue tracker for the Dart SDK. Getting the SDK source is easy, and we've documented the contribution workflow . Our development tools are optimized for code reviews on Rietveld , Chromium's code review system, and they make it easy to start a review and cleanly land a patch. For very small patches, contributors can use a standard GitHub pull request. One of the easiest ways to start contributing to Dart is to wor

Dart Developer Summit videos now available

Dart developers met in San Francisco for two days in April 2015 to share stories, meet engineers, and learn about how to deploy Dart for the web, server, and mobile. If you missed the event, don't worry. You can now watch all the Dart Developer Summit presentations on YouTube . Check out the playlist to see a wide range of content: case studies, insight into new features and libraries (such as async/await ), a game engine built with Dart , deploying Dart to Internet of Things , deploying Dart on the server , using Dart in Google , and much more. We also saw two new interesting experiments to bring Dart to mobile: the Dart for Mobile Services project and the Sky project . A big thank you to everyone that joined us in person and on the live stream. We hope you enjoy the videos , and we'll see you in the Dartiverse!

Announcing DartPad: A friction-free way to explore Dart code

We believe developers deserve a fast iteration cycle, immediate feedback, and zero-install tools as they explore languages and APIs. To help both new and experienced Dart developers, today we are announcing DartPad 1.0, a friction-free way to try Dart code and APIs in your browser. Developers new to Dart can use DartPad to experience the language and libraries. Experienced Dart developers will find DartPad the easiest way to experiment with the core APIs and learn new patterns and idioms. Everyone can use DartPad to share snippets of Dart code. DartPad supports the full Dart language, the core libraries, and even HTML/CSS. Easily discover APIs with DartPad's support for code completion. Quickly find issues in your code with real-time errors and warnings. Learn more about APIs with real-time docs. Easily share your Dart code with DartPad's integration with Github's Gists. We hope developers will find DartPad a useful tool. We're just getting started, and we ap

The present and future of editors and IDEs for Dart

When we started the Dart project in 2011, we challenged ourselves to deliver a structured and lightweight language that can be supported with productive editors and tools. To bootstrap the tooling ecosystem for Dart, we built Dart Editor to explore how to make Dart developers productive with code completion, source navigation, and static analysis. Today, there are more editing and IDE options for a Dart developer than ever before. Developers are using a range of command-line tools, text editors, and full IDEs that support Dart. In what comes as no surprise, we've found that developers have very strong affinities to their particular editors, and that one size does not fit all. We've also learned that many developers are outgrowing Dart Editor, as they require source control support, plugins, extended customizability, and more. To that end, we've shifted our strategy from focusing on a single Java-based editor, to focusing on low-level tools, the Dart Analysis Server, and plu

Live analysis results with WebStorm 10 and Dart

Today, JetBrains announced the new WebStorm 10 release , which includes significant enhancements for the Dart developer. The new version adds live analysis feedback , and fixes many reported issues. We highly recommend that all WebStorm users upgrade, and that new Dart developers who want a full-featured IDE try the new WebStorm 10 release. WebStorm now provides on-the-fly code analysis results for Dart code, powered by the Dart Analysis server. You can quickly look through the list of warnings and errors in your project in a tool window or see them highlighted right in the editor. WebStorm can now auto-import new libraries into your Dart code. Simply press Control-Space twice, and you will see a list of all libraries that are available. Select the library you want to use, and WebStorm automatically adds the necessary import statement to the top of the file. You can use Dart's new async/await and generator features in WebStorm 10. Asynchronous code is now easier to writ

Dart 1.9: The release you’ve been await-ing for

Asynchronous programming is everywhere – user interaction, network access, file I/O. Dart simplifies and enhances these scenarios with the 1.9 release . Today’s release introduces async methods and await expressions built on top of our existing Future API. You can now use familiar control flow features – for/while loops, if blocks, and try/catch – to manage complex asynchronous interactions. These new features are explained thoroughly the Dart Language Asynchrony Support: Phase 1 article . Before Dart’s Future API makes it easier to compose asynchronous operations, but handling conditional cases and errors can still be difficult. After async and await make implementing the same functionality straightforward. We are also introducing generator methods – sync* and async* – that make it easy to lazily generate sequences, eliminating almost all cases where developers need to create custom iterators or manually manage stream creation. For more information, read t

Dart for the Entire Web

We work with many teams, inside and outside of Google, that use Dart every day to build business-critical apps. Their feedback is consistent: they love working with the Dart language, libraries, and tools, and they compile Dart to JavaScript when they deploy to the web.  However, they also tell us they need better integration with JavaScript, and they need an easier way to debug and optimize their apps across all modern browsers. We listened, and today we are announcing a more focused strategy for Dart for the web. In order to do what's best for our users and the web, and not just Google Chrome, we will focus our web efforts on compiling Dart to JavaScript. We have decided not to integrate the Dart VM into Chrome. Our new web strategy puts us on a path to deliver the features our users need to be more productive building web apps with Dart. It also simplifies the testing and deployment scenarios for our developers, because they can focus on a single way to build, test, and deploy

Create your own REST API with Dart

We created Dart to help make developers as productive as possible. While we were building Dart Pad (a browser-based app to help developers learn Dart), we didn't want to spend a lot of time writing boilerplate code for serialization or routing in the REST API. We built the RPC package to help make building REST APIs easier, and today we're happy to announce that it is open source and ready for you to use. You can use the RPC package to automate the data serialization and request routing for your REST API. Exposing a REST API is simple. Annotate your classes and methods with the HTTP methods, URL paths, etc. Here is an example of a simple echo service. After you configure your HTTP server (see README ), your API can now be reached at: GET http://<server url>:<port>/api/echo/v1/identity/<name> POST http://<server url>:<port>/api/echo/v1/inverse Calling your new server API from client code (written in Dart, Java, Go, iOS, Android, C#) i

Announcing Dart Developer Summit Sessions and Registration

We invite you to  Register Now  to connect with Dart engineers and developers at the first Dart Developer Summit , April 28-29 in San Francisco, California. Join us for two full days of sessions and breakouts, covering everything from client to server, embedded to mobile. You'll hear from a range of speakers from the Dart team, Googlers using Dart, and the Dart community. Some of the sessions include: Keynotes from Dart's co-founders and Google Ads Deep dives into new features like async/await and reflectable Dart for the Web state of the union Dart for Internet of Things Case studies from Trustwave , instill.io , Google Fiber , and Workiva Not one, but two  sessions on Dart for mobile Lots more! One of the best reasons to attend the summit is the opportunity to meet our engineers and community. Our breakouts and Birds of a Feather sessions ensure we collaborate and help build the future of Dart together. We look forward to connecting with you at

Highlights from the TC52 meeting on Feb 24, 2015

At the last TC52 meeting on Feb 24, 2015, we discussed a number of additional language features for Dart - including async, tear-offs and null-aware operators. Update on async Gilad reported that the implementation had, unsurprisingly, exposed some subtleties in the spec that need to be considered.  Some small adjustments in the language specification may follow from this. The virtual machine now implements the sync* mechanism.  The async* mechanism is coming along.  The dart2js implementation is complete with respect to the feature set, but it still needs to be debugged. The development of the async features has given rise to some useful insights.  For instance, sync* creates a synchronous generator, handling all the boilerplate for lazy iteration.  However, the documentation of the library classes need an enhanced level of precision in order for this to work well with the language implementation and specification.  The connection arises because the language specification s

Beautiful automated code formatting for Dart

I spend a lot of time reviewing Dart code. At Google, we use the Dart style guide , but we humans are poor at consistently following rules. I end up writing a lot of review comments like "put a newline here" and "remove this space". Although we have an automated formatter, dartfmt, to address this problem, I wasn’t happy with its output. Over the past few months, I spent a bunch of time adding a sophisticated rule engine to the formatter, helping it choose how best to format a chunk of code. There are still improvements to make, but I believe the formatter is now good enough to be run on all of the world's Dart code. We've been using this version of the formatter internally for a while, and people really like it. Everyone loves that it ends style debates and makes code reviews easier. Today, I'm happy to announce that the new formatter has landed in the dev channel SDK . Using it is as simple as:     $ dartfmt -w <file or directory> I'd

Evolving the Dart language with Dart Enhancement Proposals

In July 2014, Ecma published the first version of the Dart language specification . Ecma TC52 continues to release updated versions with new features (for example, async/await ). Our developers have asked for more insight into the discussion process, and for a formal way to seed the spec process with proposals. Today, we're happy to announce Dart Enhancement Proposals as the primary way for the Dart team and the larger Dart community to work together to evolve the Dart language and libraries. To make a great language that can be used to write great programs means we need to work together. The DEP process is how we do that. We want to: Create an open, collaborative, and inclusive Dart ecosystem. Be responsive to developer needs. Give the community a sense of shared ownership and stewardship. Be transparent about the work leading to Dart language changes. Ensure rationale for changes (or decisions not to change) is clearly communicated. Close the loop and check if stakehold

An interview with the author of Mastering Dart

Dart is more than just a language. The Dart SDK contains a robust core library (with async classes, collections, reflection and more), HTML bindings, JavaScript interop, a server-side VM, and more. Dart is easy to learn, but when you're ready to "level up", it helps to have an expert guide you through its many features and capabilities. We sat down with author Sergey Akopkokhyants, author of Mastering Dart , to learn more about his book for advanced Dart topics and techniques. Q) On behalf of the Dart team, thanks for writing Mastering Dart! So, how did you discover Dart? Sergey: The first time I heard about Dart was in 2011. I watched a Google conference and found it very interesting how this new language helped in developing web applications in a very familiar fashion with OOP, types and generics. Information was scarce at the time, so I worked to collect it myself bit by bit. Late in 2012, Ray Cromwell introduced the idea of migrating from GWT to Dart. I thi

Irregexp, the Dart VM's new RegExp implementation

Crafting regular expressions, or regexps, is an art form . They are a powerful way to search through and pattern-match strings. To give our developers faster performance (up to 150X, compared to our previous implementation) and better semantics with their regular expressions, we're happy to announce that we've finished a port of V8's Irregexp engine to the Dart VM. Previously, some regular expressions had incorrect semantics , while others had sluggish performance when run in the Dart VM. These issues are resolved by the new implementation. The behavior of regular expressions are now consistent with dart2js compiled code executed on top of V8. We hope you enjoy these improvements to Dart's regular expressions. Look for the new regular expressions implementation starting with Dart 1.9, which is now in the developer channel . Posted by Jakob Gruber and Ian Zerny , Irregular Software Engineers

Dart Language Evolution Discussed in Ecma TC52

The Dart standards committee (ECMA TC52) met on January 14th, 2015. The committee discussed several areas where the language could be improved and agreed that these should be investigated in more detail, likely leading to detailed proposals over the next few months. Configurable Imports Some libraries only work on the server, or only on the client (in particular, if dart:html has been imported then a server execution is ruled out). There may be added support for some kind of conditional compilation such that different contexts may make different choices about which libraries to import. Another proposal, which is much more complex and powerful, is concerned with parameterized libraries, e.g., libraries that may take type arguments or other libraries as arguments. Erik mentioned that the conditional compilation feature might already be included in the language, based on the ‘part’ mechanism, and Gilad agreed that that would be worth investigating, too. Union Types Union types

An interview with the author of Dart for Absolute Beginners

There are many books about the Dart language and libraries , but most assume some knowledge of programming. For people that are brand new to software development and want to learn Dart , there is now  Dart for Absolute Beginners (Apress) . We sat down with author David Kopec, to learn how people can begin their programming journey with Dart. Q) On behalf of the Dart team, thanks for writing Dart for Absolute Beginners! So, how did you discover Dart? David: Working in the startup world, I always try to keep abreast of exciting emerging technologies in the sphere of software development that may ease the lives of developers like myself. I first came across Dart in late 2012 while trying to get a consumer automotive web startup in LA off the ground. Dart was still in its early phases, but I was quickly enamored with its clean design and potential to ease Web development for both professionals and novices alike. I took a mental note and thought — this is something I need to c