Index: sdk/lib/_internal/pub/lib/src/system_cache.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/system_cache.dart b/sdk/lib/_internal/pub/lib/src/system_cache.dart |
index bfc6cea5b8d81d387f22201cb5d6e99e803a4c5e..4e011dd8f2047c8a9cc86733aee02724125f7230 100644 |
--- a/sdk/lib/_internal/pub/lib/src/system_cache.dart |
+++ b/sdk/lib/_internal/pub/lib/src/system_cache.dart |
@@ -66,6 +66,17 @@ class SystemCache { |
sources.register(source); |
} |
+ /// Determines if the system cache contains the package identified by [id]. |
+ Future<bool> contains(PackageId id) { |
+ var source = sources[id.source]; |
+ |
+ if (!source.shouldCache) { |
+ throw new ArgumentError("Package $id is not cacheable."); |
+ } |
+ |
+ return source.isInSystemCache(id); |
+ } |
+ |
/// Ensures that the package identified by [id] is downloaded to the cache, |
/// loads it, and returns it. |
/// |