Clone this repo:
  1. 2765166 Merge pull request #55 from dart-lang/add-future-or by Paul Berry · 3 months ago master
  2. 4a10db0 Update pubspec and changelog by Paul Berry · 3 months ago
  3. 5ca9545 Add type FutureOr<T> to mock SDK, and fix missing closing brace. by Paul Berry · 3 months ago
  4. 4ea2aaa Add a method to check whether an Asset is a libary (#54) by Nate Bosch · 3 months ago v0.5.1
  5. e7583dc Avoid LibraryElement instances for part files (#53) by Nate Bosch · 4 months ago v0.5.0+2

Code Transformers

This package exposes various tools to help in the creation and testing of barback transformers, as well as an interface for logging messages with constant ids for documentation purposes.

Messages and logging

This package exposes a BuildLogger class as well as Message, MessageTemplate, and MessageId classes. These work together to provide stable error messages with ids that can be referenced in documentation.


A MessageId is a constant definition of a message in a package. These are used to group messages with the same id or link to sections in a document.

const myId = const MessageId('myPackage', 0);

These ids should typically never change or disappear throughout the entire lifetime of a package.


A Message is a const object which has a MessageId and snippet.

const myMessage = const Message(myId, 'my message');


TODO(jakemac): Docs on this, see


The BuildLogger class just wraps a normal TransformLogger to provide some additional functionality. You use it in the same way as a TransformLogger except that the log methods can accept a String or a Message. This should usually be created in the first step of your transformers apply function:

apply(Transform transform) {
  // If detailsUri is passed, then a link will be output with each log
  // message that follows this format
  // `$detailsUri#${}_${}`.
  var logger = new BuildLogger(transform, detailsUri: '');

You can optionally dump out a file containing all the logs found in JSON format by calling the writeOutput method on the logger when you are done. The output file will have the same file path as the primary input of the transformer, with an extension matching this pattern ._buildLogs.$i. The i increments starting at 0 each time that logs are output (if multiple transformers run on the same file for instance). These can all be combined into a single file later on by calling the static combineLogFiles(Transform transform) function.

Testing Transformers

TODO(jakemac): Docs on this, see testPhases in

Using the Analyzer in Transformers

This package exposes a Resolver class which helps out when using the analyzer in a transform.

TODO(jakemac): Docs on this, see

Barback AssetIds and Uris

This package also provides some helpers to convert AssetIds to and from Uris relative to a source asset.

TODO(jakemac): Docs on this, see uriToAssetId & assetIdToUri in