Skip to main content

Posts

Showing posts with the label pub

New site for Dart news and articles

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

Dart 2.0 pre-releases: What they mean to you

If you publish Dart packages or like to use early releases of the Dart SDK, the next few months are going to be interesting, as apps and packages adapt to the changes required by Dart 2.0 . To make the process smoother, the pub tool that’s in Dart 2.0 pre-releases allows developers to download (and attempt to use) packages that don’t explicitly support Dart 2.0. The upshot: Use a stable Dart SDK if you need reliability . Use a pre-release Dart 2.0 SDK if you’d like to test published packages with Dart 2.0. Report any issues you find to the package maintainer. If you publish packages , be careful about SDK constraints, and expect feedback from developers trying your packages with Dart 2.0. The Dart 2.0 update page has all the details, but here’s an overview of what to expect, based on your development environment and the kind of code you write. If you use Flutter: In the short term, your Flutter code isn’t affected. When Flutter updates its Dart SDK to a

Dart 1.24: Faster edit-refresh cycle on the web & new function type syntax

Dart 1.24 is now available. It includes the Dart Development Compiler and supports a new generic function type syntax. Get it now ! Figure 1: DDC debugging in Chrome. Some notable changes in this release: pub serve now has support for the Dart Development Compiler. Unlike dart2js, this new compiler is modular, which allows pub to do incremental re-builds for pub serve. In practice what that means is you can edit your Dart files, refresh in Chrome (or other supported browsers), and see your edits almost immediately. This is because pub is only recompiling your package, not all packages that you depend on. There is one caveat with the new compiler, which is that your package and your dependencies must all be strong mode  clean. You can also use the new compiler to run your tests in Chrome much more quickly than you can with dart2js. Read more  in the changelog. You can now publish packages that depend on the Flutter SDK to pub. Moreover, pub.dartlang.org  has started tagging Flutt

Pub's New Constraint Solver

TL;DR: Pub now has a new constraint solver that will pick versions of packages that work with your SDK. No more "doesn't work with your SDK " errors.  This should appear in your life in the next SDK build. Pub's job is to look at your dependencies and select the best versions for them. Given things like  shared dependencies, that's surprisingly hard. NP-complete, in fact. So our initial version solver for pub was a very simple one. It would always terminate in a reliable amount of time, but that meant it could fail to find a solution to your package's constraints even when a solution existed. One area where that's painfully obvious is SDK constraints. Because the Dart SDK itself is changing rapidly, any package likely only works with one or a couple of versions of the SDK. A while back, we added support so you could note  which versions of the SDK your package supports . Unfortunately, pub's solver was too simple to do take advantage of

BIG BREAKING CHANGE: dart.js Bootstrap File is Moving to Pub

dart.js file is moving to Pub and can be found in the new  browser  package. The familiar link to dart.js from your html files, should be replaced by declaring a dependency to this package, or by hosting a local file .  This is a far reaching change that will impact all browser based Dart applications ; Dartisans are urged to follow the   advice provided by Vijay Menon :  FYI: We are moving the bootstrap file dart.js to pub.  Please update any links to dart.js from your html files accordingly.   We will delete the old copy of dart.js in our repository in a couple weeks. The dart.js file is used in Dart browser apps to check for native Dart support and either (a) bootstrap Dartium or (b) load compiled JS instead.  Previously, we've recommended that you add a script tag pointing the version of dart.js in our repository.  This doesn't work offline and also results in slower startup (see  dartbug.com/6723 ). Instead, we now recommend that you ins

New Article Detailing Dart Milestone 2 Changes

The Dart team announced its Milestone 2 (M2) release today. Seth Ladd   has a new article   detailing the many changes and improvements that M2 brings. Find out about smaller dart2js output, improved libraries, SSL in the Dart VM, the Web UI library, direct publishing to pub, new http, oauth2 and serialization packages, and more: As always, we invite you to join our  Dart mailing list , ask questions on  Stack Overflow , or file feature requests on  dartbug.com .

Dart Milestone 2 Brings Smaller JavaScript Output and Package Uploads to Pub

Anders Sandholm gives us some of the details  of the Milestone 2 (M2) release : We’re happy to announce the next milestone of the Dart project - M2. The bits for the editor and SDK are available at dartlang.org . A few features you may like in this release: Significantly smaller generated JavaScript from dart2js due to tree-shaking of the html libraries and general minification.  Tree-shaking is on by default. Minification requires the command line flag --minify .  As a result, the generated code for swarm is now only half the size compared to M1. Support for uploading of user packages to pub . The M3 release will focus on core library cleanup and the new streaming API for asynchronous communication. We’re looking forward to your feedback and thanks for your support. As always, we invite you to join our  Dart mailing list , ask questions on  Stack Overflow , or file feature requests on  dartbug.com .

New Dart Web UI Codelab

If you've been waiting for the right time to learn how to use Web Components in Dart, now's your chance! Continuing where we left off with the Google IO 2012 Dart Codelab , I've created a Dart Web UI Codelab which focuses on Web Components and the new Web UI library. In this codelab, I cover: How to set up pub How to use Web Components How to use dynamic templates and two-way data binding (inspired by Model-driven Views) How to build an application with multiple Web Components Where to get more information about Web Components and the Dart Web UI package What to do if you get stuck while trying to build an app using the Dart Web UI package We've already created videos , blog posts , and articles about how to use Web Components in Dart, but this codelab is pretty exciting in that it walks you through building a complete, albeit small, application using Web Components and the Dart Web UI library. So give it a try and tell us what you think! We invite

SDK Packages Now Available on pub.dartlang.org

SDK packages are now available on pub.dartlang.org. This means that you can now declare a dependency in the following manner:  Before this change, you had to rely on the sdk: Dan Grove provides the details :  I've just finished uploading the packages from the dart repo's pkg directory to pub - this means that you can use  args http intl logging meta oauth2 unittest webdriver through regular pub dependencies in your pubspec.yaml, rather than sdk: dependencies. We'll keep these updated when we do our weekly releases from trunk. Enjoy! As always, we invite you to join our  Dart mailing list , ask questions on  Stack Overflow , or file feature requests on  dartbug.com .

New Article: Writing Unit Tests for Pub Packages

Don't know how to get started with testing your Dart code? This  new article  by Shailen Tuli provides a gentle introduction to creating a Dart package and writing unit tests for it.  Read this article to get started and then find out more about  Pub packages  and  Unit Testing with Dart . As always, we invite you to join our  Dart mailing list , ask questions on  Stack Overflow , or file feature requests on  dartbug.com .

Breaking Change: Remove Support for Old Style Pub Package Layouts

Dart engineer  Bob Nystrom   writes to tell us about the change: Many moons ago , there was a  great enlightenment  and pub discovered that it had not just one, but two ways of laying out packages. As always, the new way was proclaimed my many and sundry as "better" but some aging adherents preferred the old ways. Prophets warned that a great cataclysm (referred to cryptically only as "M1") would render the old package layout unsupported and  relegated to myths and legends . The time of the cataclysm is now. Henceforth and forever more, there is but one way to lay out your pub packages, the  One True Way . Those who refuse to follow the path will find their packages un-importable. Those of you who have heeded the omens have nothing to fear: your packages are already safely applying the most harmonious layout, and their is naught for you to do. Those of you who have ignored the signs... ...well, mainly you just have to move your Dart libraries out

Dart Team Updates, Oct 30 - Nov 13

The Dart team has been busy. Anders Sandholm  writes : On Dart  core libraries  we've introduced a library fork in experimental/lib_v2. Discussions and prototypes on Streams (called “Observable” in C#). Started work on refactoring the collections library. (Almost) removed library core_impl. noSuchMethod now takes an InvocationMirror. In the  dart:io  library, we've implemented HTTP session and HTTP basic authentication support. We fixed bugs in the HTTP library and fixed a bug that caused Pub to fail (because of accessing files open in other processes on Windows). We're also working on improving IO performance and started landing HTTPS support. For  dart:html , we now have implementations and interfaces merged, dart:svg is split from dart:html and there's new support for keycodes. In the  Dart VM , the GC is now collecting unreferenced compiled code to avoid running out of code heap. The compiler now has bounds check elimination for some array accesses and w

More Dart libraries ready for use, thanks to Pub

One of the big features of the Dart M1 release is our package manager, pub . You can discover, install, and manage 3rd party Dart libraries with pub. Pub is a command-line app with Dart Editor integration, as well as a hosting service for Dart packages. We've been uploading select packages, but soon you'll be able to upload your own packages to pub. I sat down with two of the pub engineers, Bob Nystrom and Nathan Weizenbaum , to learn more about pub and what's on the roadmap. Q) What exactly is a package? Bob: It’s a directory containing Dart code and all of the other stuff that goes along with it: tests, docs, examples, resources. It also has metadata that describes the package and its dependencies–the other packages it relies on. Nathan: It’s important to note that Dart applications can be packages even if they don’t export any libraries and they’re not going to be re-used anywhere. As long as it declares its dependencies in a pubspec, pub considers it a pa

New pub package layout

Today, Bob Nystrom, one of the pub engineers, posted details about the new pub package layout . Time to use the new layout for your packages! Bob writes: If you live on bleeding_edge, pub now supports the new package layout conventions that avoid the nasty circular symlinks. Pub also still supports the old style too, simultaneously. It works like this: When pub is generating a symlink to a package it determines if it's an old style or new style package. The presence of a .dart file at the top level (aside from build.dart) indicates that it's an old style package. If it's an old style package, pub symlinks to the package's root directory. If it's a new style package, it looks for a "lib" directory inside that package and symlinks to that. It will also generate a self link, but  only  for new style packages. So, if you have: myapp/   pubspec.yaml -> depends on old_style and new_style   lib/     app.dart old_style/   ol