Skip to content
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

Send data from flutter to web app #306

Open
vinitk-aveosoft opened this issue Aug 8, 2024 · 0 comments
Open

Send data from flutter to web app #306

vinitk-aveosoft opened this issue Aug 8, 2024 · 0 comments

Comments

@vinitk-aveosoft
Copy link

Hey forks, I am working on a app which needs a Rich text editor. I have designed editor using React and self hosted the build HTML, CSS, JS with "shelf" and "shelf_flutter_asset" and viewing it with WebView.

Operation 1: Sending onChange data from Web App Editor to Flutter and saving it on DB (Successful)
I used below code
Editor end:
((e) => { console.log("debouncedEditorData: ", e); window.chrome.webview.postMessage(e); })

Flutter end:
`webViewController.webMessage.listen(
    (event) async {
      kprint(
          title: 'webview', object: 'On Message from Window Webview : $event');
    },
  );`

Operation 2: I want to send data from flutter to editor so I can prefill it when the editor is loaded for the first time (Need help here)
I tried with triggering a demo function like below
kprint( title: 'WebView', object: await webViewController .executeScript('triggerCustomEvent();'));
Problem I am facing is that I was able to add a new function above the main function.
The main function is too huge after being compiled and I have no clue how to trigger the prefilling function.
Is there any other way to tackle this using some kind of anchor or any alternate approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant