I successfully integrated the Tawk.to chat bot in my flutter project by copying the script in my HTML body section.
I was wondering how I can toggle it in dart by clicking on a widget
I followed the documentation here https://help.tawk.to/article/using-a-text-link-or-button
in my flutter code I tried two methods
Calling the link using url_launcher package
Future<void> toggleBot() async { final url = Uri.parse("javascript:void(Tawk_API.toggle())"); if (!await launchUrl(url)) { throw 'Could not launch $url'; }}Using dart:js to call java script
js.context.callMethod("window.Tawk_API.toggle()");
both of these methods do not work. what am I doing wrong? and how do I achieve what I am trying to achieve