Use JS library in Flutter

后端 未结 3 1344
庸人自扰
庸人自扰 2020-12-23 12:29

I am trying to use Ether JS in my Flutter application. I know that it is not directly supported and even the existing implementations are not really well documented.

3条回答
  •  伪装坚强ぢ
    2020-12-23 13:07

        Future loadJS(String name) async {
      var givenJS = rootBundle.loadString('assets/$name.js');
      return givenJS.then((String js) {
        flutterWebViewPlugin.onStateChanged.listen((viewState) async {
          if (viewState.type == WebViewState.finishLoad) {
            flutterWebViewPlugin.evalJavascript(js);
          }
        });
      });
    }
    

提交回复
热议问题