flutter_workmanager icon indicating copy to clipboard operation
flutter_workmanager copied to clipboard

Is it possible to call native android code via method chanels inside the callbackDispatcher ?

Open tempo-riz opened this issue 1 year ago • 3 comments
trafficstars

I'm trying to call android method via platform chanels. They work fine when called from main isolate but when calling from my callbackDispatcher I always get "Error in background task: MissingPluginException(No implementation found for method ... my android method)"

Is it intended to work or not in the first place ? Can't find doc about this Thanks for any clues !

tempo-riz avatar Aug 25 '24 16:08 tempo-riz

any updates?

narzullayev0772 avatar Dec 24 '24 04:12 narzullayev0772

I would also be very interested in the answer.

sirkalmi avatar Mar 03 '25 10:03 sirkalmi

@tempo-riz I faced the same issue, and the only workaround that worked for me was extracting the native methods into an independent Flutter plugin. This ensures proper initialization in the background isolate.

ghassenbenzahra123 avatar Mar 14 '25 23:03 ghassenbenzahra123

Could you share some code?

ened avatar Jul 29 '25 22:07 ened

I believe this issue persists. I get the exact same error:

MissingPluginException(No implementation found for method ... )

@ghassenbenzahra123 I'll try your solution, thanks.

Well, I got it to work with the independent Flutter plugin. I created it inside the same project, which ultimately worked, but it is basically impossible to debug the code, because I didn't have any lint or checks for errors. The errors just appeared when I ran the project. Is there a better way to implement this plugin?

ErlendKH avatar Sep 08 '25 12:09 ErlendKH