feat: Add task execution callback registration to BackgroundTaskService and update geofence dispatcher to use it

This commit is contained in:
Achintha Isuru
2026-03-14 00:59:39 -04:00
parent 2889098f9f
commit 08a4326da4
2 changed files with 36 additions and 24 deletions

View File

@@ -55,4 +55,16 @@ class BackgroundTaskService extends BaseDeviceService {
Future<void> cancelAll() async {
return action(() => Workmanager().cancelAll());
}
/// Registers the task execution callback for the background isolate.
///
/// Must be called inside the top-level callback dispatcher function.
/// The [callback] receives the task name and optional input data, and
/// must return `true` on success or `false` on failure.
void executeTask(
Future<bool> Function(String task, Map<String, dynamic>? inputData)
callback,
) {
Workmanager().executeTask(callback);
}
}