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

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

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 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