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

162
Vistas
Problems using promiseToFuture with an object coming from context.callmethod ()

As the title suggests, I am trying to use promiseToFuture (function of the dart library dart:js_util) on an object deriving from the method of DART:JS which is context.callmethod (''), whose objective is to perform a JavaScript function, which identifies through the string passed as a parameter; The code below:

  void onWalletConnect() {

    var promiseWallet =
        await promiseToFuture(js.context.callMethod('JsConnectWallet'));
    // ignore: avoid_print
    print(promiseWallet);

    if (promiseWallet['address'].compareTo('errorAddress') != 0) {
      setState(() {
        walletAddress = promiseWallet['address'];
        isWalletconnect = true;
      });
    }
  }




// "`js.context.callMethod('..')` Returns an Object Promise; "

Below the import:

import 'dart:js' as js;
import 'dart:js_util';

To the execution of promisetofutures() [and I am sure that this is the function that generates error and not the js.context.callMethod()] I get the following error from the Chrome console:

"

Uncaught (in promise) TypeError: js.Promise.then in not a function
   at Object.promiseToFuture (js_util.dart:275:35)
   at _first._MyHomePageState.new.OnWalletConnect (_first.dart:28:1)

"

I don't understand why you generate this error and how to solve it, can anyone help me?

about 4 years ago · Juan Pablo Isaza
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