How do I trigger a function when using HtmlElementView Widget?
I just found the workaround for this one.So basically, we can take advantage of window.localStorage where it can be accessed from both flutter and html, and add listener in flutter for any change in window.localStorage
Add listener inside the flutter
final Storage webLocalStorage = window.localStorage;
htmlListener(){String buttonClicked = webLocalStorage["buttonClicked"];if(buttonClicked=="yes"){//do whatever}else{Future.delayed(Duration(milliseconds: 100), (){htmlListener();});}}
Do some change to the webstorage in the HTML
var webLocalStorage = window.localStorage;webLocalStorage["buttonClicked"] = "yes";
And you can do the same vice versa, that is listen from html, change in flutter.