Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

159
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!