flutter_workmanager
flutter_workmanager copied to clipboard
Improve the docs for `callbackDispatcher`
Use case
I setup the WorkManager plugin in my void main(){} entrypoint.
However I found the plugin documentation a bit confusing.
Firstly, the function can be a static method as well, which the plugin does not mention.
Secondly, the name callbackDispatcher is a bit misleading. taskRunner / taskExecutor would be a better fit?
Lastly, I find it odd that the plugin claims that null and Map (of the supported datatypes) are not supported, while Isolates do support them.
From the docs of PluginUtilities.getCallbackHandle
Returns a [CallbackHandle] that can be provided to [PluginUtilities.getCallbackFromHandle] to retrieve a tear-off of the original callback. If callback is not a top-level or static function, null is returned.
Apparently I misunderstood what the callback dispatcher does.
Perhaps the documentation could be improved?
callbackDispatcher is a weird name for a function that is actually the task runner that defines what should happen when a task is running.
callbackDispatcher is a weird name for a function that is actually the task runner that defines > what should happen when a task is running.
I think the better name is callbackInvoker.