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

589
Visualizações
Flutter Web: How to get query params from service worker?

I have a native website (e.g. blabla.com) and I'm passing data with query parameters to a flutter website. Params not showing in link. But I can see in devtool my data.

enter image description here

enter image description here

My question is; how can I get data from service worker. Thanks...

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I found a solution to use. in web/index.html, I've created a function:

<script type="application/javascript">
  const params = new Proxy(new URLSearchParams(window.location.search), {
    get: (searchParams, prop) => searchParams.get(prop),
   );

  function getEmail() {
    return params.email;
  }
</script>

and in the main.dart file, I imported dart:js package

import 'dart:js' as js;

and I call it that I've created javascript function in web/index.html

String? email;
  
Future<void> getEmail() async {
  setState(() {
    email = js.context.callMethod('getEmail');
  });
}

I added the codes above in case other people need it. thanks

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