execution library
Flutter-free execution registry shared by the interactive app and the
headless --background-task process.
The headless process launched by a systemd unit runs the whole Flutter engine (unlike the web worker bundle), so the dispatcher may use Flutter plugins. The small execution contract still lives in this Flutter-free library so the dispatcher can register its handler without touching platform channels (there is no native counterpart on Linux to talk to).
A dispatcher written for Linux registers its handler with WorkmanagerExecution.executeTask:
@pragma('vm:entry-point')
void callbackDispatcher() {
WorkmanagerLinux.executeTask((taskName, inputData) async {
// Background work. Flutter plugins are allowed here.
return true;
});
}
Classes
- WorkmanagerExecution
- Shared registry that holds the currently registered background task handler.