| Index: pkg/barback/lib/src/asset_set.dart
|
| diff --git a/pkg/barback/lib/src/asset_set.dart b/pkg/barback/lib/src/asset_set.dart
|
| index f58e188cb2be5e5ff2f75b2a28dbf72e40e622c6..b432425608b2b7b3d79fc7aabe1a47a54dfcde45 100644
|
| --- a/pkg/barback/lib/src/asset_set.dart
|
| +++ b/pkg/barback/lib/src/asset_set.dart
|
| @@ -18,6 +18,18 @@ import 'asset_id.dart';
|
| class AssetSet extends IterableBase<Asset> {
|
| final _assets = new Map<AssetId, Asset>();
|
|
|
| + AssetSet();
|
| +
|
| + /// Creates a new AssetSet from the contents of [other].
|
| + ///
|
| + /// If multiple assets in [other] have the same id, the last one takes
|
| + /// precedence.
|
| + AssetSet.from(Iterable<Asset> other) {
|
| + for (var asset in other) {
|
| + _assets[asset.id] = asset;
|
| + }
|
| + }
|
| +
|
| Iterator<Asset> get iterator => _assets.values.iterator;
|
|
|
| int get length => _assets.length;
|
| @@ -51,6 +63,9 @@ class AssetSet extends IterableBase<Asset> {
|
| return _assets.containsKey(id);
|
| }
|
|
|
| + /// If the set contains an [Asset] with [id], removes and returns it.
|
| + Asset removeId(AssetId id) => _assets.remove(id);
|
| +
|
| /// Removes all assets from the set.
|
| void clear() {
|
| _assets.clear();
|
|
|