work_vault library
Background download control plane for Flutter.
The public API schedules work and observes it. Platform workers are reached
through the Pigeon contract in pigeons/messages.dart.
Classes
- BatteryConstraint
- Power conditions the scheduler must satisfy before a task runs.
- NotificationMetadata
- Notification copy for a running transfer and its completion.
- RetryPolicy
- Delay schedule used when a transfer fails and can be retried.
- TaskFailure
- Why a task reached TaskStatus.failed.
- TaskProgress
- One progress sample for a transfer.
- TaskSnapshot
- Last known state of a task.
- WorkTaskConfig
- Description of one download.
- WorkVault
- Schedules downloads and exposes their status and progress.
- WorkVaultBackgroundEvent
- One host event delivered to Dart while the UI engine is not attached.
- WorkVaultDatabase
- Storage interface shared by vault isolates and engines.
- WorkVaultLinux
- Linux platform plugin registration for work_vault.
- WorkVaultMacOS
- macOS platform plugin registration for work_vault.
- WorkVaultTaskRecord
- One persisted download row.
- WorkVaultWindows
- Windows platform plugin registration for work_vault.
Enums
- HttpMethod
- HTTP verb stored with a task.
- NetworkConstraint
- Which networks may carry a transfer.
- Sha256VerificationStatus
- SHA-256 check of a completed download.
- TaskCommand
- A command the caller can issue against a non-terminal task.
- TaskStatus
- Lifecycle of one task.
Constants
- workVaultBackgroundChannel → const String
- Method channel shared by the UI engine and a headless background engine.
- workVaultBackgroundEntrypoint → const String
- Entrypoint function name. The host looks this up in workVaultBackgroundLibrary.
- workVaultBackgroundLibrary → const String
-
Library URI the host passes to
DartEntrypoint/FlutterEngine.run.
Functions
-
nextTaskStatus(
TaskStatus from, TaskCommand command) → TaskStatus? -
Next status after
command, or null when the command is illegal. -
registerWorkVaultBackgroundHandler(
WorkVaultBackgroundHandler handler) → Future< void> -
Persists
handlerand tells the host its callback handle. -
taskStatusIsTerminal(
TaskStatus status) → bool -
Whether
statuswill not change again. -
workVaultBackgroundMain(
) → void - Headless entry point.
Typedefs
- TaskObservation = ({TaskProgress? progress, TaskSnapshot snapshot})
- A cached snapshot paired with the progress sample it currently carries.
-
WorkVaultBackgroundHandler
= Future<
void> Function(WorkVaultBackgroundEvent event) - User callback invoked from the headless engine.
Exceptions / Errors
- DuplicateTask
- taskId is already present.
- IllegalTaskTransition
- Pause, resume, or cancel is not legal from the current status.
- InvalidWorkConfig
- A task config or retry policy failed validation.
- PlatformFault
- The platform channel failed, or the native engine is not linked yet.
- TaskNotFound
- taskId is not in the vault.
- TransferFailed
- The transfer failed on the host.
- WorkVaultFailure
- Failure raised by WorkVault before or after a platform call.
- WorkVaultNotInitialized
-
WorkVault.initializehas not completed.