Hi folks,
I mentioned
last week that barback
0.13.0 would include a breaking change to the signature of
Transformer.isPrimary. That change was released early this week, but most of you won't have seen it yet, since pub 1.3 has a version constraint on barback
<0.13.0.
Now we're preparing the first dev channel release of version 1.4 of the SDK, whose pub will have a version constraint on barback >=0.13.0 <0.14.0. This means that it will be incompatible with existing packages that implement the old version of the Transformer.isPrimary API.
What if I have a package that defines a transformer?
Luckily, it's easy to update your transformers to be compatible with both 1.3 and 1.4. All you need to do is check whether the parameter to Transformer.isPrimary is an Asset or an AssetId. For example, if you used to have
Future<bool> isPrimary(Asset asset) =>
new Future.value(asset.id.path.endsWith("/myfile.txt"));
you can change it to
Future<bool> isPrimary(assetOrId) {
var id = assetOrId is Asset ? assetOrId.id : assetOrId;
return new Future.value(id.path.endsWith("/myfile.txt"));
}
What if I have a package that uses a transformer?
You don't need to do anything! Once a new barback-0.13.0-compatible version of the transformer you use is released, just run "pub get" and everything will work great. Until then, either stick with 1.3 or submit a pull request to the transformer author.
Let me know if you have any questions!
- N