Is it possible for FlutterFlow to receive and react to messages from a webview

Widgets & Design

I want to put a webview inside my FlutterFlow app and receive data from that webview. When the data is sent from the webview, I need FlutterFlow to detect it and show a button so I can save that data to the database. The problem is FlutterFlow’s custom widgets and actions can’t listen to messages from the webview in real time. I want to know if it’s possible for FlutterFlow to receive and react to messages from a webview inside the app, or if I have to build this part fully in Flutter code outside FlutterFlow.

What have you tried so far?

I tried using a custom widget with an iframe to load the webview and listen for messages sent from the webview’s JavaScript using window.postMessage. I set up code to detect those messages and pass the data back to FlutterFlow, but FlutterFlow didn’t recognize the custom widget properly or couldn’t handle the message callback. I also tried creating a custom action to save the data after receiving it, but the communication between the webview and FlutterFlow didn’t work as expected. I considered polling the webview from FlutterFlow periodically, but that approach seems unreliable and expensive.

Did you check FlutterFlow's Documentation for this topic?
Yes
5
2 replies