Call JavaScript async function in flutter dart future returns THIS: (a string) [Object Promise]

518 views Asked by At

I have a flutter web where i have a JavaScript function like this:

async function doSomething(value) {
   let x = await something(x);
   return x
}

When I'm now in dart, I have:

final result = await js.context.callMethod('doSomething', ['someValue']));

This returns [object Promise] when I print it. I don’t understand why I get this.

1

There are 1 answers

0
Kevin Moore On

Try importing dart:html and use window.console.log(result)