NativeWorkManager class

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

events Stream<TaskEvent>
Stream of task completion events.
no setter
progress Stream<TaskProgress>
Stream of task progress updates.
no setter

Static Methods

allTasks() Future<List<TaskRecord>>
Return all tasks from the persistent SQLite task store, newest first.
beginWith(TaskRequest task) TaskChainBuilder
Start building a task chain with a single initial task.
beginWithAll(List<TaskRequest> tasks) TaskChainBuilder
Start building a task chain with multiple parallel initial tasks.
cancel({required String taskId}) Future<void>
Cancel a specific task by its ID.
cancelAll() Future<void>
Cancel all scheduled tasks.
cancelByTag({required String tag}) Future<void>
Cancel all tasks with a specific tag.
configure({ObservabilityConfig? observability}) → void
Configure observability hooks for all background tasks.
enqueue({required String taskId, TaskTrigger trigger = const TaskTrigger.oneTime(), required Worker worker, Constraints constraints = const Constraints(), ExistingTaskPolicy existingPolicy = ExistingTaskPolicy.replace, String? tag}) Future<TaskHandler>
Schedule a background task.
enqueueAll(List<EnqueueRequest> requests) Future<List<TaskHandler>>
Enqueue multiple tasks at once and return their ScheduleResults.
enqueueGraph(TaskGraph graph) Future<GraphExecution>
Schedule a TaskGraph (directed acyclic graph) of background tasks.
getAllTags() Future<List<String>>
Get all tags currently in use.
getRunningProgress() Future<Map<String, TaskProgress>>
Get the current progress of all running tasks.
getServerFilename(String url, {Map<String, String>? headers, int timeoutMs = 30000}) Future<String?>
Fetch the server-suggested filename for a URL by sending a HEAD request and parsing the Content-Disposition header (RFC 6266).
getTaskRecord({required String taskId}) Future<TaskRecord?>
Get detailed task record.
getTasksByStatus(TaskStatus status) Future<List<TaskRecord>>
Return all tasks that match a given status.
getTasksByTag({required String tag}) Future<List<String>>
Get all tasks with a specific tag.
getTaskStatus({required String taskId}) Future<TaskStatus?>
Get the current status of a task.
initialize({Map<String, DartWorkerCallback>? dartWorkers, bool debugMode = false, int maxConcurrentTasks = 4, int diskSpaceBufferMB = 20, int cleanupAfterDays = 30, bool enforceHttps = false, bool blockPrivateIPs = false, bool registerPlugins = false}) Future<void>
Initialize the work manager.
isDartWorkerRegistered(String id) bool
Check if a Dart worker is registered.
openFile(String path, {String? mimeType}) Future<void>
Open a file with the system default application.
pause({required String taskId}) Future<void>
Pause a running download task.
pauseAll() Future<void>
Pause all currently-running tasks.
pauseByTag({required String tag}) Future<void>
Pause all running tasks that share a given tag.
registerDartWorker(String id, DartWorkerCallback callback) → void
Register additional Dart workers after initialization.
registerMiddleware(Middleware middleware) Future<void>
Register a middleware for background tasks.
registerRemoteTrigger({required RemoteTriggerSource source, required RemoteTriggerRule rule}) Future<void>
Register a remote trigger for background task execution.
reportDartWorkerProgress({String? taskId, required int progress, String? message}) Future<void>
Report progress from inside a DartWorker callback.
reportTestEvent(TaskEvent event) → void
Report a task event manually for testing purposes.
reportTestProgress(TaskProgress progress) → void
Report a task progress manually for testing purposes.
resetInitializedState() → void
Internal testing only - resets initialized state so initialize() can be called again with different parameters in the same test process.
resetSecurityFlags() → void
Internal testing only - resets security flags.
resume({required String taskId}) Future<void>
Resume a previously paused download task.
resumeAll() Future<void>
Resume all currently-paused tasks.
resumeByTag({required String tag}) Future<void>
Resume all paused tasks that share a given tag.
setMaxConcurrentPerHost(int max) Future<void>
Set the maximum number of concurrent downloads per host.
unregisterDartWorker(String id) → void
Unregister a Dart worker.
useFirebase({bool logToAnalytics = true, bool logToCrashlytics = true}) → void
Convenience stub for Firebase Analytics / Crashlytics integration.
useSentry({bool addBreadcrumbs = true, dynamic sentryInstance}) → void
Convenience stub for Sentry integration.