I have a flutter added into my android host project.
I am currently having multiple flutter engines.
But there is no sharing of code between these engines.
Therefore method-channel calls are happening multiple times.
I have a single entry point for all the engines.
I tried using singleton in my flutter code, but that is also executed multiple times.
What would be a good solution to this.
I read ‘IsolateGroup’ can be used but I haven’t implemented it yet so I don’t have a reference.
2
Answers
I found 2 solutions on this :
To share common code between multiple Flutter engines, you can create a separate Dart package that contains the shared code and then import that package into each engine that needs to use it. This allows you to maintain a single source of truth for the shared code and easily update it in all places where it is used. You can create a Dart package using the pub package manager and publishing it to a package repository such as pub.dev. Once the package is published, you can import it into your Flutter app using the dependencies section of your pubspec.yaml file.