-
Notifications
You must be signed in to change notification settings - Fork 936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set local variable to post message whenever a new one is listened #305
Comments
This is how I solved this issue: initState() of my Flutter class where I'm using the webview widget.
Added this under WebviewManager's constructor: and this inside WebviewManager.
and created a stream inside base.dart
and added 'test' case under _handleMessages
You can change the type, parse string to json object on both ends etc. Hope this was helpful. |
Where is the WebviewManager? |
I have updated the code changes in the source files. How do build this now to apply in compiled plugin. |
@wackyapps
|
Hello,
I can listen to post messages on browser like this but I didn't quite understand how I can set a local variable to event.data.
I tried
and you can set testLocal to test but I couldn't apply it to post message.
Also, I tried setting value of test inside script1 and trigger onUrlChanged inside receiveMessage function and access it from script2. The variables in script1 were not accessible by script2.
Can we use a callback function to communicate between app & webview?
Thanks
The text was updated successfully, but these errors were encountered: