Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda