execution library

Flutter-free execution registry shared by the page, the compiled Web Worker bundle and (via that bundle) the Service Worker.

The callback dispatcher compiled into the worker bundle cannot import Flutter packages, so the small execution contract used by a dispatcher lives in this library instead of in package:workmanager_web/workmanager_web.dart.

A dispatcher written for the web registers its handler with WorkmanagerExecution.executeTask:

void callbackDispatcher() {
  WorkmanagerExecution.instance.executeTask((taskName, inputData) async {
    // Flutter-free background work only.
    return true;
  });
}

Classes

WorkmanagerExecution
Shared registry that holds the currently registered background task handler.

Typedefs

BackgroundTaskHandler = Future<bool> Function(String taskName, Map<String, dynamic>? inputData)
Signature of the handler invoked when a background task runs.