ekibun / flutter_qjs

A quickjs engine for flutter.
https://pub.dev/packages/flutter_qjs
MIT License
146 stars 28 forks source link

用的官方例子调用dio 返回的是个 Instance of 'Future<dynamic>' #18

Closed xiaoyaoking closed 3 years ago

xiaoyaoking commented 3 years ago

await setToGlobalObject.invoke(["http", (String url) { return Dio().get(url).then((response) => response.data); }]);

返回的是个 Instance of 'Future' js无法直接调用,求解。

xiaoyaoking commented 3 years ago

额 解决了。。。 刚看到了 Promise 返回 Future 的需要下方处理一下

get_info().then(function onFulfilled(value){ debug(value.model); //获取成功 }).catch(function onRejected(error){ debug(error); //失败 });