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 4e011dd8f2047c8a9cc86733aee02724125f7230..9cfca43046c3c820b8b6f75b105a8f162e1e4711 100644 |
--- a/sdk/lib/_internal/pub/lib/src/system_cache.dart |
+++ b/sdk/lib/_internal/pub/lib/src/system_cache.dart |
@@ -82,7 +82,10 @@ class SystemCache { |
/// |
/// It is an error to try downloading a package from a source with |
/// `shouldCache == false`. |
- Future<Package> download(PackageId id) { |
+ /// |
+ /// If [force] is `true`, then the package is downloaded even if it already |
+ /// exists in the cache. The previous one will be deleted. |
+ Future<Package> download(PackageId id, {bool force}) { |
var source = sources[id.source]; |
if (!source.shouldCache) { |
@@ -92,7 +95,8 @@ class SystemCache { |
var pending = _pendingDownloads[id]; |
if (pending != null) return pending; |
- var future = source.downloadToSystemCache(id).whenComplete(() { |
+ var future = source.downloadToSystemCache(id, force: force) |
+ .whenComplete(() { |
_pendingDownloads.remove(id); |
}); |