-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Description
Use case
I'm currently writing a chart library for the company that I work for. After some research, we didn't find a good package that have the features that we want. So our decision was to write our own.
We have both an web app and app (React and Flutter). And with the Element Embedding
feature we want to reuse this package for both platforms.
After some tests using the master
branch, there was two things that I found that would be really cool to add/improve (don't actually know if it's on your roadmap already)
Proposal / Questions
I wasn't able to create two instances of the app. Is there or will be a way to create multiple instances of the app in a page? This is the code that I have used.
const initChart = (targetSelector) => {
let target = document.querySelector(targetSelector);
_flutter.loader.loadEntrypoint({
onEntrypointLoaded: async function (engineInitializer) {
let appRunner = await engineInitializer.initializeEngine({
hostElement: target,
});
await appRunner.runApp();
},
});
}
window.addEventListener("load", function (ev) {
initChart('#flutter_target');
initChart('#flutter_target_2');
});
With this code, the first app is stopped and the second one works.
Will be there a way to export single widgets instead of having to export the whole app?
Using the current way, it's possible to achieve what I want using a wrapper around the _flutter.loader.loadEntrypoint
and calling the state methods to update the state. But will be there a better way to do that?