-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE REQUEST] Plugin support #34
Comments
Hi! This is definitely something I've intended to look at at some point. I'll have to look at what the overhead for this would be, and what I'd need to do to make integral_isolate still be able to run in a pure Dart environment too. |
Hello again! I am sorry for being so slow at investigating this but I've had a lot of stuff on my plate, and to be honest, this feature request was not on top of my list. I have tried something that seems to work for me, but I also want to check if it will solve it for you too. If you try calling this piece of code before making any calls to a plugin: // Define as a top level function or a static function, just as normal
void _initPluginForIsolate(RootIsolateToken rootIsolateToken) {
BackgroundIsolateBinaryMessenger.ensureInitialized(rootIsolateToken);
print('I am init!');
}
...
// Creating the isolate
isolate = StatefulIsolate();
final rootIsolateToken = RootIsolateToken.instance!;
await isolate.compute(_initPluginForIsolate, rootIsolateToken); Are you able to call the plugins you wish to work then? If it works well, I'll try to neatly wrap it in a nice package and do it automatically in Flutter apps. |
I realise now that I repeated exactly what you said and didn't actually solve your problem 🙈 |
Glad you're looking into it. However, to be perfectly candid, when I opened this issue I was investigating something and trying out several isolate related packages, but I can't remember what I was searching then... So I can't really follow up on my initial request or help you push this further. |
I believe I've come to the conclusion that I will need to implement native code for all supported platforms in order to support hooking up native calls to push data to Flutter. Thank you for the feature request, it is definitely something that I really want to have eventually! |
Is your feature request related to a problem? Please describe.
Trying to call a plugin within a spawn isolate fails. This limits use cases for this package.
Describe the solution you'd like
Since 13937 it's possible to pass a root token and call
BackgroundIsolateBinaryMessenger.ensureInitialized
within the isolate. But it only works for some plugins (those that dodart -> platform
messenging, but notplatform -> dart
messenging). Hopefully this package can do the necessary plumbing so that it works whatever the plugin.Describe alternatives you've considered
flutter_isolate
is another package trying to make isolates nicer, and it supports plugins, but it has its own issues and limitations.The text was updated successfully, but these errors were encountered: