Skip to content

build 0.7.0

Compare
Choose a tag to compare
@jakemac53 jakemac53 released this 27 Jan 21:31
· 2019 commits to master since this release

A number of changes to the apis, primarily to support reading/writing as bytes,
as this is going to inevitably be a required feature. This will hopefully be the
last breaking change before the 1.0 release, but it is a fairly large one.

New Features

  • The AssetWriter class now has a
    Future writeAsBytes(AssetId id, List<int> bytes) method.
  • The AssetReader class now has a Future<List<int>> readAsBytes(AssetId id)
    method.
  • You no longer need to call Resolver#release on any resolvers you get from
    a BuildStep (in fact, the Resolver interface no longer has this method).
  • There is now a BuildStep#resolver getter, which resolves the primary input,
    and returns a Future<Resolver>. This replaces the BuildStep#resolve
    method.
  • Resolver has a new isLibrary method to check whether an asset is a Dart
    library source file before trying to resolve it's LibraryElement

Breaking Changes

  • The Asset class has been removed entirely.
  • The AssetWriter#writeAsString signature has changed to
    Future writeAsString(AssetId id, String contents, {Encoding encoding}).
  • The type of the AssetWriterSpy#assetsWritten getter has changed from an
    Iterable<Asset> to an Iterable<AssetId>.
  • BuildStep#input has been changed to BuildStep#inputId, and its type has
    changed from Asset to AssetId. This means you must now use
    BuildStep#readAsString or BuildStep#readAsBytes to read the primary input,
    instead of it already being read in for you.
  • Resolver no longer has a release method (they are released for you).
  • BuildStep#resolve no longer exists, and has been replaced with the
    BuildStep#resolver getter.
  • Resolver.getLibrary will now throw a NonLibraryAssetException instead of
    return null if it is asked to resolve an impossible library.

Note: The changes to AssetReader and AssetWriter also affect BuildStep
and other classes that implement those interfaces.