project library

The project toolkit just and its plugins share: finding a project, editing its pubspecs without disturbing them, changing it all or nothing, running pub, and reading what pub resolved.

Classes

Checkout
A local checkout of one of the ecosystem's packages.
DependencySpec
A dependency as a tool writes it into a pubspec.
Path overrides from a project to local checkouts, in just dev link's own block of pubspec_overrides.yaml — never pubspec.yaml, because the paths are this machine's.
FileHashes
Hashes files so a tool can tell a local edit from what it installed.
FlutterSdk
A Flutter SDK on this machine.
GitIgnores
A project's .gitignore, added to without disturbing it.
GraphNode
One package in PackageGraph.
HostedDependency
name: ^1.2.0, from pub.dev (or url's repository).
JsonFields
A JSON object read field by field, each read naming its path when it fails. Unknown fields are ignored, so newer files still read.
JustProject
A Dart or Flutter project: the folder holding its pubspec.yaml.
JustProjectFile
A project's just.json.
ManagedBlock
Whose block a PubspecEditor edits: the markers around the entries one tool owns. Each tool edits only its own block, so several tools — a plugin that installs packages, just dev link — can manage overrides in the same file. Each tool defines its own block, and keeps its markers as projects already hold them.
OtherDependency
A dependency written in a form a tool doesn't write itself (git, sdk, flow maps with several keys…). Kept as text.
OverridesTarget
Where a tool writes dependency_overrides.
PackageConfig
.dart_tool/package_config.json: every package in the resolution and its folder, plus the Flutter SDK that resolved it.
PackageGraph
.dart_tool/package_graph.json: who depends on whom, and at which version — what a tool checks constraints against, since overrides skip pub's own checks.
PackageNames
Rules for package names (pub's) and the names written into generated code.
PackageSet
Packages, at versions that work together, under a name (id).
PathDependency
name: {path: ...}, written as a block.
ProcessPubRunner
Runs the SDK's own dart pub get, which needs no Flutter tool lock — so it works while flutter run holds one — and falls back to flutter pub get.
ProjectLock
One change at a time per project: an install, an edit, an upgrade.
ProjectNames
What a new project is called, and how its files name it.
ProjectPaths
Where things are in a project, relative to its root, with / between parts — the names alone, so code on any platform (the web included) can use them. JustProject (in package:just_core_cli/project.dart) finds them on disk.
ProjectTransaction
One change to a project, journalled so it can be undone.
PubResult
What a pub get run printed, and whether it worked.
PubRunner
Runs pub get for a project. Tests use a fake.
PubspecConstraints
Edits the constraint of an entry written on one line — name: ^1.2.3 — in a top-level section, leaving every other byte as it was: comments, order, line endings, the section's indent. Entries written as blocks or flow collections (path:, git:, {path: ..}) and entries inside a tool's managed block are left alone.
PubspecEditor
A pubspec.yaml or pubspec_overrides.yaml held as lines, edited only inside one tool's marked block (marker) — here my_tool's, made with ManagedBlock('my_tool', hint: 'my_tool add'):
ResolvedPackage
A package pub resolved, and where it is on disk.
SdkLocator
Finds the Flutter SDK a project uses.
SetPackage
One package of a set.
Sha256
A running SHA-256 hash: add the data in pieces, then close.
TemplateRenderer
Fills a template's placeholders for one project.
ToolSet
The tools just keeps a project on: just_core_cli itself, and the plugin of each kind of project just create makes (kinds).
UserPaths
Per-user folders shared by the just tool and what builds on it, outside any project: caches and settings.
Version
A semantic version (semver 2.0): 1.2.3, 1.2.3-dev.4, 1.2.3+5.
VersionConstraint
Which versions are acceptable, written the way pubspecs write it: any, 1.2.3, ^1.2.3, >=1.0.0 <2.0.0.

Enums

PackageSource
Where a package in a set comes from.

Functions

canonicalJson(Object? value, {bool pretty = true}) → String
value as the ecosystem's tools write every JSON file: keys sorted, two-space indents, LF line endings and a final newline. The same data always gives the same bytes, so files diff cleanly and hash stably.
compactJson(Map<String, Object?> map) → Map<String, Object?>
Drops null values and empty lists or maps from map, so files only carry what is set.
copyAtomic(File from, File file) → void
Replaces file with a copy of from, as writeBytesAtomic writes: never seen half-written, through a symbolic link, and with from's permissions on macOS and Linux.
isSha256Hex(String text) → bool
Whether text is a SHA-256 digest written as 64 lowercase hex digits.
normalPath(String path) → String
path with / between parts and no trailing / (a drive root such as C:/ keeps its own).
retryOnLock<T>(T action(), {int attempts = 6}) → T
Runs action, retrying a few times with growing pauses when Windows says a file is in use (an antivirus scan, an indexer, the analyzer).
writeBytesAtomic(File file, List<int> bytes) → void
writeTextAtomic for bytes.
writeTextAtomic(File file, String text) → void
Writes text to file so that it is never seen half-written: into a temporary .saving file beside it — named for this write alone, so two writers never share one — then renamed over it. The temporary file is removed when anything fails.

Exceptions / Errors

DevLinkClash
The same package checked out in more than one of the folders given to DevLinks.scanAll.
JsonFormatException
A JSON file that is not valid: wrong JSON shape, a missing field, a value out of range.
ProjectBusyException
Another tool is changing the project right now.
PubspecEditException
A pubspec a tool can't edit safely, or an edit that would clash with lines it doesn't own.