flutter_workmanager icon indicating copy to clipboard operation
flutter_workmanager copied to clipboard

Improve the docs for `callbackDispatcher`

Open navaronbracke opened this issue 3 years ago • 2 comments

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.

navaronbracke avatar Jun 14 '22 14:06 navaronbracke

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.

navaronbracke avatar Jun 15 '22 15:06 navaronbracke

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.

bambinoua avatar Nov 10 '22 16:11 bambinoua