ProjectCache class final

The project cache and its patches.

dpk keeps a git baseline of the cache's hosted/ folder, recorded right after pub downloads packages. Edits to a package show up as differences from that baseline, and dpk patch generate saves them as patch files. Git dependencies are their own git checkouts, so their baseline is the checked-out commit.

Constructors

ProjectCache({required String cachePath, required String patchPath, required String lockfilePath, required Git git, required Console console})
ProjectCache.forProject(Project project, DpkContext context)
factory

Properties

cachePath → String
final
console → Console
final
exists → bool
no setter
git → Git
final
hasBaseline → bool
no setter
hashCode → int
The hash code for this object.
no setterinherited
lockfilePath → String
final
patchPath → String
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

apply({bool force = false}) → Future<int>
Applies every patch that is not applied yet, and returns how many were.
generate({List<String> packages = const []}) → Future<({List<String> removed, List<String> written})>
Saves the edits in the project cache as patch files, and returns the patch paths written and removed, relative to the patch directory.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patches() → List<PatchFile>
The patch files in the patch directory.
remove(String package) → Future<List<String>>
Deletes the patches for package (a name or a cache folder name) and resets that package in the project cache. Returns the removed paths.
stateOf(PatchFile patch) → Future<PatchState>
The state of patch against the lockfile and the project cache.
sync() → Future<int>
Brings the baseline up to date and applies every patch. Run after pub changes the resolved packages.
toString() → String
A string representation of this object.
inherited
updateBaseline({bool rebuild = false}) → Future<void>
Creates the baseline when there is none, and adds packages that pub downloaded since the last update. With rebuild, discards every edit in the cache and records a fresh baseline.

Operators

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