PubCache class
Used to locate and manipulate the dart pub cache
Constructors
- PubCache()
-
factory
- PubCache.forScope()
-
Use this ctor to alter the location of .pub-cache
during testing.
factory
Properties
- cacheDir → String
-
Returns the directory name of the pub cache.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- pathTo ↔ String
-
The fully qualified path to the pub cache.
getter/setter pair
- pathToBin → String
-
The fully qualified path to the pub cache's bin directory
where executables from installed packages are stored.
no setter
- pathToDartLang → String
-
Path to the PubCache's hosted/pub.flutter-io.cn directory
where all of the downloaded packages from pub.flutter-io.cn live.
no setter
- pathToHosted → String
-
Path to the pub cache hosted directory
Prior to Dart 2.19: hosted/pub.flutter-io.cn
From Dart 2.19: this changed to hosted/pub.flutter-io.cn
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
findPrimaryVersion(
String packageName) → Version? - Finds and returns the latest (non-pre-release) version installed into pub cache for the given package.
-
findVersion(
String packageName, String requestedVersion) → String? -
Searches for
requestedVersionofpackageNamein pub-cache and returns the fully qualified path to that version. If the version is not found then null is returned; -
globalActivate(
String packageName, {String? version, bool verbose = false}) → void -
Run dart pub global activate on the given
packageName. Ifversionis passed then we activate the specific version otherwise we activate the latest version from the packages stable channel. Theverboseoption is for debugging activation problems and does a full dump to console of the dart pub log. -
globalActivateFromSource(
String path) → void -
Run dart pub global activate for a package located in
pathrelative to the current directory. -
globalDeactivate(
String packageName) → void -
Run dart pub global deactivate on the given
packageName. -
isGloballyActivated(
String packageName) → bool - returns true if the given package has been globally activated
-
isGloballyActivatedFromSource(
String packageName) → bool -
Returns true if the the dart project
packageNameis running from local source. This means that the package has been activated via -
isInstalled(
String packageName) → bool - Returns true if the package is installed in pub-cache
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pathToPackage(
String packageName, String version) → String -
Returns the path to the package in .pub-cache for the dart
project named
packageNamefor the versionversion. e.g. ~/.pub-cache/hosted/pub.flutter-io.cn/dswitch-4.0.1 -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- envVarPubCache → const String
- The name of the environment variable that can be set to change the location of the .pub-cache directory. You should change this path by calling pathTo.