Description
When registering a one-off task via Workmanager().registerOneOffTask(uniqueName, taskName, ...), the taskName value received in the executeTask callback is correct on Android but incorrect on iOS. On iOS the callback receives uniqueName where taskName is expected.
Steps to reproduce
Register a task with distinct values for both parameters:
await Workmanager().registerOneOffTask(
'uniqueName', // unique identifier
'taskName', // task name used in callback
initialDelay: Duration(seconds: 5),
);
In the callback, log or display the received taskName:
Workmanager().executeTask((taskName, inputData) async {
print("Task: $taskName"); // "taskName" on Android, "uniqueName" on iOS
return Future.value(true);
});
Expected behaviour
The callback parameter taskName should receive the value 'taskName' (second argument) on both Android and iOS.
Actual behaviour
- Android: callback receives
"taskName" β
- iOS: callback receives
"uniqueName" β β the first parameter is passed instead of the second.
Environment
|
Version |
| Flutter |
^3.11.0 |
| workmanager |
^0.9.0+3 |
Additional context
This is likely a parameter mapping issue in the iOS native bridge. On Android, uniqueName and taskName are registered and forwarded separately; the iOS implementation appears to forward uniqueName in place of taskName when invoking the Dart callback.
Description
When registering a one-off task via
Workmanager().registerOneOffTask(uniqueName, taskName, ...), thetaskNamevalue received in theexecuteTaskcallback is correct on Android but incorrect on iOS. On iOS the callback receivesuniqueNamewheretaskNameis expected.Steps to reproduce
Register a task with distinct values for both parameters:
In the callback, log or display the received
taskName:Expected behaviour
The callback parameter
taskNameshould receive the value'taskName'(second argument) on both Android and iOS.Actual behaviour
"taskName"β"uniqueName"β β the first parameter is passed instead of the second.Environment
Additional context
This is likely a parameter mapping issue in the iOS native bridge. On Android,
uniqueNameandtaskNameare registered and forwarded separately; the iOS implementation appears to forwarduniqueNamein place oftaskNamewhen invoking the Dart callback.