Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
PostMessage from flutter to inappwebview

There are many answers to this regarding the flutter_webview package but not a single one for flutter_inappwebview which we are using for a few reasons.

So is there any way to fire up a method from anywhere inside the flutter widget tree that posts/sends anything to the inappwebview for which I can listen there with JS to do something (like a console.log with the received message)?

I also opened a github issue with a little more detail and a code snippet for this although I'm not sure how frequently the dev is looking for it (he has many issues there) so I figured asking the stackoverflow community makes sense. Here's the github issue for convenience: https://github.com/pichillilorenzo/flutter_inappwebview/issues/1037

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can trigger javascript function from flutter by following these steps

  1. Need to execute evaluate javascript function from flutter as below

    _webViewController.evaluateJavascript(source: """
     var event = new CustomEvent("demoJavaScriptListener", {detail: {});
    window.dispatchEvent(event); """);
    
  2. Now in Javascript side you need write a listener as below

    window.addEventListener("demoJavaScriptListener", (event) => {
        console.log("My custom Event");
        var map= JSON.parse(JSON.stringify(event.detail));
        console.log("map",map);
    });
    
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!