| Index: pkg/barback/lib/src/base_transform.dart
|
| diff --git a/pkg/barback/lib/src/base_transform.dart b/pkg/barback/lib/src/base_transform.dart
|
| index ea85f02371552204ce7de7645e17e2ba35d922eb..c0de0f8ac26d5ee171f273cf6e593087aeaa6e3f 100644
|
| --- a/pkg/barback/lib/src/base_transform.dart
|
| +++ b/pkg/barback/lib/src/base_transform.dart
|
| @@ -110,6 +110,17 @@ abstract class BaseTransform {
|
| Stream<List<int>> readInput(AssetId id) =>
|
| futureStream(getInput(id).then((input) => input.read()));
|
|
|
| + /// A convenience method to return whether or not an asset exists.
|
| + ///
|
| + /// This is equivalent to calling [getInput] and catching an
|
| + /// [AssetNotFoundException].
|
| + Future<bool> hasInput(AssetId id) {
|
| + return getInput(id).then((_) => true).catchError((error) {
|
| + if (error is AssetNotFoundException && error.id == id) return false;
|
| + throw error;
|
| + });
|
| + }
|
| +
|
| /// Consume the primary input so that it doesn't get processed by future
|
| /// phases or emitted once processing has finished.
|
| ///
|
|
|