'Flutter webview with innerHTML callback issue

I am calling a webview, lets call it main index.html that has a JS file with displayAlert() method. It has another index.html as its innerHTML(this is inside a test folder). Whenever i call await webViewController.runJavascript("displayAlert()");, it gives Uncaught ReferenceError : displayAlert is not defined, source:file"///PATH_TO_ANDROID_STORAGE/test/index.html Somehow the callback is being forwarded to innerHTML instead of main index.html processing it. This happens only on android and not on iOS. I am using "https://pub.dev/packages/webview_flutter"



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source