feat: Add task execution callback registration to BackgroundTaskService and update geofence dispatcher to use it
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user