Flutter get custom data from Javascript

66 Views Asked by At

I have this code on the Javascript side, and I cannot modify it due to it is another person's website.

if (window.android) {
  window.android.onEventJs('register_success');
}

with Android, I can get it easily by using @JavascriptInterface, but how can I do it the same way in Flutter?

This is what I've tried with Flutter Webview:

..addJavaScriptChannel(
    'window.android.onEventJs',
    onMessageReceived: (JavaScriptMessage message) {
      debugPrint("JS- coming data $message");
     
    },
  )
0

There are 0 best solutions below