upkeep library
The truth about your Flutter project's health.
The command line tool is the product; this library exists so the engine can be embedded, tested, and later reused by the CI integration.
Classes
- AgpRequirement
- The published requirements for one AGP minor version line.
- AndroidConfig
-
The Android build configuration
upkeepwas able to read. - AndroidMatrixChecker
- Validates a project's Android build configuration against Google's published AGP requirements.
- ApplyResult
- What happened when a plan was applied.
- AutomaticFix
-
A change
upkeep fix --applycan make on its own. - CuratedReplacement
- One curated successor, with the evidence behind it.
- CuratedReplacements
- Attaches curated successors to reports that need one.
- DeclaredDependency
-
One dependency as declared in
pubspec.yaml. - DependencyReport
- The verdict on one declared dependency, with the reasons behind it.
- ExitCodes
- Process exit codes. CI depends on these, so they are part of the contract.
- FixApplier
- Applies the automatic part of a FixPlan.
- FixPlan
-
Everything
upkeep fixwould do for one project. - FixPlanner
- Turns scan results into a plan.
- FixTodo
- A change only a person can make, with everything they need to make it.
- HealthEngine
- Scores dependencies against pub.dev facts.
- HealthThresholds
- The thresholds the engine runs on, grouped so they can be tuned and tested in one place rather than scattered through the logic.
- Lockfile
-
The resolved versions recorded in
pubspec.lock. - MatrixFinding
- One statement about the Android build configuration.
- MemoryPubCache
- Keeps responses for as long as the process or page lives.
- PackageInfo
- What pub.dev knows about one package.
- PackageLookup
- The result of looking one package up.
- ProjectAnalysis
- Everything upkeep concludes about one project.
- PubClient
- Reads package facts from the public pub.dev API.
- PubResponseCache
- Stores pub.dev responses between lookups.
- Pubspec
-
A parsed
pubspec.yaml. - RaiseGradleWrapper
- Points the Gradle wrapper at the version the AGP in use requires.
- Reference
- One place a package is mentioned in the project.
- ReferenceIndex
- Every place the project refers to its dependencies.
- RemoveDependency
- Removes a blocking dependency that nothing in the project refers to.
- Style
- ANSI styling, switched off when output is piped or NO_COLOR is set.
Enums
- DepSource
- Where a declared dependency comes from.
- FindingLevel
- How serious a matrix finding is.
- LookupStatus
- Whether a package could be looked up at all.
- MatrixCheck
- Which part of the matrix a finding is about.
- OutputFormat
- How a command writes its result.
- ReplacementSource
- Who named a dependency's replacement.
- Verdict
- One dependency's health, most serious first.
Constants
-
agpMatrix
→ const List<
AgpRequirement> -
Every AGP line
upkeepknows about, oldest first. -
curatedReplacements
→ const List<
CuratedReplacement> - curatedReplacementsVerified → const String
- The date the entries below were last checked against pub.dev and their sources.
- jsonSchemaVersion → const int
- The machine-readable form of every command, for CI and other tools.
- upkeepVersion → const String
- The published version of this tool.
Properties
- newestKnownAgp → AgpRequirement
-
The newest AGP line in the bundled matrix.
no setter
Functions
-
analyzeProject(
{required Pubspec pubspec, required Lockfile lockfile, required AndroidConfig? android, required PubClient pub, required Version dartVersion}) → Future< ProjectAnalysis> -
Judges
pubspecagainst pub.dev facts and the Android matrix. -
attachSuccessors(
List< DependencyReport> reports, PubClient pub, HealthEngine engine) → Future<List< DependencyReport> > -
Looks up and attaches curated successors for
reports. -
compareLooseVersions(
String a, String b) → int -
Compares dotted numeric versions such as
8.10.2and8.13. -
curatedReplacementFor(
String package) → CuratedReplacement? -
The curated successor for
package, if there is one. -
currentDartVersion(
) → Version - The Dart SDK running this process.
-
formatCount(
int n) → String -
Formats a count for humans: 4214118 becomes
4.2M. -
loadAndroidConfig(
String projectRoot) → AndroidConfig? -
Reads the Android build configuration under
projectRoot. -
loadLockfile(
String projectRoot) → Lockfile -
Reads
pubspec.lockfromprojectRoot, or an empty lockfile when there is none. -
loadPubspec(
String projectRoot) → Pubspec - Reads a project from disk for the command line.
-
requirementForAgp(
String agpVersion) → AgpRequirement? -
The requirements for
agpVersion, matched on itsmajor.minorline. -
runExplain(
{required String package, required String projectPath, bool useCache = true, OutputFormat format = OutputFormat.text, Style? style, StringSink? out, PubClient? client}) → Future< int> -
Runs
upkeep explain <package>and returns the process exit code. -
runFix(
{required String projectPath, bool apply = false, bool allowDirty = false, bool useCache = true, bool failOnAtRisk = false, OutputFormat format = OutputFormat.text, Style? style, StringSink? out, PubClient? client, PubGetRunner pubGet = runPubGet}) → Future< int> -
Runs
upkeep fixand returns the process exit code. -
runPubGet(
String root, {required bool flutter}) → Future< ProcessResult> -
Runs the real
flutter pub getordart pub get. -
runScan(
{required String projectPath, bool useCache = true, bool failOnAtRisk = false, OutputFormat format = OutputFormat.text, Style? style, StringSink? out, PubClient? client}) → Future< int> -
Runs
upkeep scanand returns the process exit code. -
scanReferences(
String root, Iterable< String> packageNames) → ReferenceIndex -
Indexes where the project at
rootrefers topackageNames.
Typedefs
-
PubGetRunner
= Future<
ProcessResult> Function(String root, {required bool flutter}) -
Runs
pub getfor the project atrootand reports whether it resolved.
Exceptions / Errors
- ApplyRefused
-
Why
upkeep fix --applydeclined to touch anything. - PubspecException
-
Raised when
pubspec.yamlcannot be read or understood.