Flutter
Assuming you have already integrated the Scrimmage Rewards Widget into your Flutter application, you can listen to events emitted by the widget by adding a JavaScript interface to the WebView.
var message = '';
// ...
WebView(
// ...
javascriptChannels: Set.from([
JavascriptChannel(
// Use ScrimmageChannel for communication
name: 'ScrimmageChannel',
onMessageReceived: (JavascriptMessage message) {
setState(() {
this.message = message.message;
print('Received message from WebView: ${message.message}');
});
},
),
]),
)
Check out the Widget Events API for more information.
Updated about 1 year ago