user22331356
user22331356

Reputation:

How can I use other plugins in workmanager with flutter?

I have an Android plugin in my Flutter project used to access the backend.

In my MainActivity.kt, I have :

override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
    GeneratedPluginRegistrant.registerWith(flutterEngine)
    flutterEngine.getPlugins().add(BackendChannelPlugin())
}

This works great, but when trying to use my plugin from an isolate spawned by workmanager, the plugin isn't registered (I get a Missing implementation error). How can I register my plugin in the Flutter Engine used by workmanager ? Every solution I've found on the internet has to do with the old PluginRegistrant callback implementation, which is now deprecated.

Upvotes: 2

Views: 74

Answers (0)

Related Questions