Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda