DesktopUpdaterController class

Coordinates update checks, downloads, and install handoff for UI code.

The controller owns the high-level UpdateState used by the ready-made widgets and by custom Flutter UI. Automatic startup checks run quietly and report failures through state; explicit calls such as checkVersion keep throwing so apps can handle user-triggered failures directly.

Inheritance

Constructors

DesktopUpdaterController({required Uri? appArchiveUrl, required String expectedPackageId, required UpdateRecoveryStore recoveryStore, required Map<String, String> trustedReleasePublicKeys, DesktopUpdateLocalization? localization, String channel = "stable", String? installationIdentity, UpdatePreferences? preferences, DesktopUpdaterTelemetry? telemetry, MinimumOSSupportChecker? isMinimumOSSupported, UpdateRequestHeadersProvider? requestHeadersProvider, UpdateDiagnosticsRecorder? diagnosticsRecorder, Future<void> onProblemReport(UpdateProblemReport report)?, FutureOr<void> onCleanupReport(UpdateCleanupReport report)?, bool skipInitialVersionCheck = false, ReleaseNotesLoader? releaseNotesLoader, Uri? releaseNotesUrl, ExternalUrlLauncher? externalUrlLauncher})
Creates a controller for a hosted zip-first app archive.
DesktopUpdaterController.forTesting({required Uri? appArchiveUrl, required String expectedPackageId, required UpdateRecoveryStore recoveryStore, required Map<String, String> trustedReleasePublicKeys, DesktopUpdateLocalization? localization, String channel = "stable", String? installationIdentity, UpdatePreferences? preferences, DesktopUpdaterTelemetry? telemetry, MinimumOSSupportChecker? isMinimumOSSupported, UpdateRequestHeadersProvider? requestHeadersProvider, UpdateDiagnosticsRecorder? diagnosticsRecorder, Future<void> onProblemReport(UpdateProblemReport report)?, FutureOr<void> onCleanupReport(UpdateCleanupReport report)?, bool skipInitialVersionCheck = false, ReleaseNotesLoader? releaseNotesLoader, Uri? releaseNotesUrl, ReleaseNotesFetcher? releaseNotesFetcher, ExternalUrlLauncher? externalUrlLauncher, bool? isWindows})
Creates a controller with injected collaborators for unit testing.

Properties

activeDescriptor → ReleaseDescriptor?
Descriptor selected by the latest successful update check, if any.
no setter
activeFreshInstall → ReleaseFreshInstall?
Fresh-install policy for the active update, when present.
no setter
activeSupportPolicy → ReleaseSupportPolicy?
Support policy applying to the active update, when present.
no setter
appArchiveUrl → Uri?
Hosted app-archive.json URL used for update checks.
no setter
appName → String?
Name of the app from the active release descriptor, when available.
no setter
appVersion → String?
Version from the active release descriptor, when available.
no setter
canLoadReleaseNotes → bool
Whether release notes can be loaded for the selected update descriptor.
no setter
canReportProblem → bool
Whether the app supplied an explicit problem-report callback.
no setter
channel → String
Release channel used for update selection and skip preferences.
final
diagnosticsRecorder → UpdateDiagnosticsRecorder
In-memory diagnostics recorder used to build failure reports.
no setter
expectedPackageId → String
App-owned expected package identity for signed metadata and install.
final
getLocalization → DesktopUpdateLocalization?
Current localization values used by bundled update UI.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
installationIdentity → String?
Stable app-owned identity used for deterministic staged rollouts.
final
isMinimumOSSupported → MinimumOSSupportChecker?
Optional app-owned minimum OS support policy.
final
lastCleanupReport → UpdateCleanupReport?
Most recent install scheduling or cleanup report emitted by this controller.
no setter
localization ↔ DesktopUpdateLocalization?
Optional strings used by bundled update UI.
getter/setter pair
preferences → UpdatePreferences?
Optional app-owned persistence adapter for skipped versions.
final
recoveryStore → UpdateRecoveryStore
App-owned durable persistence adapter for pending install recovery.
final
releaseNotesState → ReleaseNotesState
Current release notes loading state.
no setter
releaseNotesUrl → Uri?
Optional URL for hosted release notes JSON.
no setter
requestHeadersProvider → UpdateRequestHeadersProvider?
Optional app-owned HTTP headers for update metadata and artifact requests.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
skipInitialVersionCheck → bool
Whether construction should avoid starting the first automatic check.
no setter
skipUpdate → bool
Whether the user has skipped the currently offered update in this session.
no setter
state → UpdateState
Current update lifecycle state for UI rendering.
no setter
telemetry → DesktopUpdaterTelemetry?
Optional app-owned telemetry callback.
final
trustedReleasePublicKeys → Map<String, String>
Pinned Ed25519 public keys required for app archive and descriptor trust.
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
checkForUpdates() → Future<ManualUpdateCheckResult>
Checks for updates for an explicit user action and returns a typed result.
checkVersion() → Future<void>
Checks for a newer release and updates state.
dispose() → void
Discards any resources used by the object.
override
downloadUpdate() → Future<void>
Downloads, verifies, and stages the active release descriptor.
fetchReleaseNotes() → Future<ReleaseNotes>
Fetches and returns the hosted release notes.
init(Uri url) → void
Sets the app archive URL and starts the initial update check when enabled.
loadReleaseNotes({bool forceRefresh = false}) → Future<ReleaseNotes>
Loads release notes for the active update descriptor.
makeSkipUpdate() → Future<void>
Marks the currently available update as skipped for this controller.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
openFreshInstallDownload() → Future<void>
Opens the active fresh-install download URL.
openMacOSBackgroundItemsSettings() → Future<void>
Opens macOS Background Items settings for privileged helper approval.
recoverPendingInstall() → Future<void>
Recovers a pending native install marker from the app-owned store.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reportProblem(UpdateProblemReport report) → Future<void>
Invokes the app-owned problem-report callback when one was supplied.
restartApp() → Future<void>
Hands the staged update to the native installer or restart helper.
retryInstallAfterMacOSHelperApproval() → Future<void>
Recovers an approval-denied macOS handoff, stages a fresh verified artifact, and retries the install.
toString() → String
A string representation of this object.
inherited

Operators

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