I get the location in my Flutter app. I have a WebView and I want to pass the location inside it (to handle it after in the site opened within the webview).
var userLocation = Provider.of<UserLocation>(context);
And my WebView:
WebView(
initialUrl: widget.url,
javascriptMode: JavascriptMode.unrestricted,
)
Is there a way to do it? My goal is like a binding between flutter and angular sending continuous location data.
normally To receive data from flutter we add js function in html
function fromFlutter(location) {
document.getElementById("locationId").innerHTML = location;
sendBack();
}
and then in flutter create a web view controller then
_controller.evaluateJavascript('fromFlutter("From Flutter")');
or for variable containing location
_controller.evaluateJavascript('fromFlutter("$locationVar")');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With