flutter_ota_cli library
Developer CLI for Flutter OTA System (flutter_ota), and the toolchain API later milestones
use: ToolchainManager(ctx).resolve(lock) returns the verified toolchain paths and build
environment, or throws ToolchainUnavailableException (there is never a fallback to a stock
or global Flutter SDK).
Classes
- CachePaths
-
Layout of the CLI cache (default
~/.cache/flutter_ota, overrideFLUTTER_OTA_CACHE): - CliContext
- Everything the CLI reads from the outside world, injectable for tests.
- ConfigValue
- DoctorCheck
- One doctor result line.
- Lockfile
-
flutter_ota.lock: the exact toolchain a project builds with. Written only by the CLI (toolchain installin a project without a lock, orupgradeafter confirmation). - ResolvedToolchain
- Paths and build environment of an installed, verified toolchain. This is what later milestones (release, patch) use; they must never run the developer's global Flutter.
- ToolchainArtifact
- One downloadable archive of a toolchain.
- ToolchainEntry
- One supported toolchain: a pinned stock Flutter SDK plus our overlay.
- ToolchainIndex
- A verified toolchain index.
- ToolchainManager
- UserConfig
-
The user's CLI config:
$XDG_CONFIG_HOME/flutter_ota/config.yaml(default~/.config/flutter_ota/config.yaml), file mode 0600.FLUTTER_OTA_CONFIG_DIRoverrides the directory (tests, CI).
Enums
- ConfigSource
- Where a resolved setting came from.
Constants
- cliVersion → const String
- Keep in sync with pubspec.yaml.
-
configEnv
→ const Map<
String, String> - Environment variables that override the config file.
-
configKeys
→ const Map<
String, String> - Settings a user may store (never private keys or admin secrets).
- genSnapshotSdkPath → const String
- Relative path of the Android arm64 release gen_snapshot inside a Flutter SDK.
- lockFileName → const String
- projectFileName → const String
- supportedHost → const String
- The only host the toolchain binaries (gen_snapshot, tool snapshots) are built for.
- toolchainDirEnv → const String
- Environment variable of the developer/owner escape hatch (see ToolchainManager.resolve).
-
toolSnapshots
→ const List<
String> -
The tool snapshots every toolchain ships (run with the SDK's
dartaotruntime).bc_verifyis the reference bytecode verifier (prototypes/security_hardening/tools/bc_verify), whichpatch androidruns on every module before it is signed.
Functions
-
computeToolchainId(
Map< String, Object?> record) → String -
Recomputes the content-hash id of a
toolchain.jsonrecord: SHA-256 of the canonical JSON of every field exceptid(same rule as prototypes/security_hardening/tools/toolchain.py). -
dfFreeBytes(
String path) → Future< int?> -
Uses POSIX
df -Pk(Linux hosts only, see decision D3). -
findProjectDir(
String start) → String? -
Finds the nearest directory (from
startupwards) that containsflutter_ota.yaml. -
mirrorFilesFor(
String engineCommit) → List< String> - Maven artifacts the local mirror must contain for an Android arm64 release build.
-
projectFileContent(
String appId) → String -
The exact content of a new
flutter_ota.yaml. -
readAppId(
String projectDir) → String -
Reads
app_idfromflutter_ota.yaml. The file may contain nothing else. -
runCli(
List< String> args, {CliContext? context}) → Future<int> -
Runs the
flutter_otaCLI and returns the process exit code. -
validateAppId(
String raw) → String - Validates and normalises (lower case) a server application UUID. Slugs, Android package names and other identifiers are refused with an explanation.
Typedefs
Exceptions / Errors
- CliException
- A user-facing error: the CLI prints message (no stack trace) and exits with exitCode.
- DiskSpaceException
- Not enough free disk space for the requested operation.
- DownloadInterruptedException
- A download stopped before the end. The partial file is kept so the next run can resume.
- IndexVerificationException
- The toolchain index could not be trusted (bad, missing or unknown-key signature, bad format).
- IntegrityException
- A downloaded file did not match the size or SHA-256 recorded in the signed index.
- LockBusyException
- Another process holds the install lock for this toolchain.
-
The toolchain pinned by
flutter_ota.lockis missing or failed verification. The CLI never falls back to another (stock or global) Flutter SDK.