SystemCache class

The system-wide cache of downloaded packages.

This cache contains all packages that are downloaded from the internet. Packages that are available locally (e.g. path dependencies) don't use this cache.

Constructors

SystemCache({String? rootDir, bool isOffline = false})
Creates a system cache and registers all sources in sources.

Properties

cachedPubspecs Map<PackageId, Pubspec>
An in-memory cache of pubspecs described by describe.
final
defaultSource → Source
no setter
git → GitSource
The built-in Git source.
no setter
hashCode int
The hash code for this object.
no setterinherited
hosted → HostedSource
The built-in hosted source.
no setter
isOffline bool
If true, cached sources will attempt to use the cached packages for resolution.
final
path → PathSource
The built-in path source bound to this cache.
no setter
rootDir String
The root directory where this package cache is located.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sdk → SdkSource
The built-in SDK source bound to this cache.
no setter
tempDir String
no setter
tokenStore → TokenStore
The default credential store. TODO(sigurdm): this does not really belong in the cache.
final

Methods

clean() → void
Removes all contents of the system cache.
createTempDir() String
Create a new temporary directory within the system cache.
deleteTempDir() → void
Deletes the system cache's internal temp directory.
describe(PackageId id) Future<Pubspec>
Loads the (possibly remote) pubspec for the package version identified by id.
downloadPackage(PackageId id) Future<DownloadPackageResult>
Downloads a cached package identified by id to the cache.
getDirectory(PackageId id, {String? relativeFrom}) String
Returns the directory where this package can (or could) be found locally.
getLatest(PackageRef? package, {Version? version, bool allowPrereleases = false}) Future<PackageId?>
Get the latest version of package.
getVersions(PackageRef ref, {Duration? maxAge, Version? allowedRetractedVersion}) Future<List<PackageId>>
Get the IDs of all versions that match ref.
load(PackageId id) → Package
Loads the package identified by id.
maintainCache() → void
Tasks that ensures the cache is in a good condition. Should be called whenever an operation updates the cache.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rootDirForSource(CachedSource source) String
sources(String? name) → Source
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

defaultDir String
getter/setter pair