dint-dev / universal_html

Cross-platform 'dart:html'.
https://pub.dev/packages/universal_html
Apache License 2.0
201 stars 61 forks source link

html.document.removeEventListener is not running properly #24

Closed chentianxin closed 3 years ago

chentianxin commented 4 years ago

No matter how I trigger the delete event, it's useless

void initState() {
  super.initState();
  html.document.addEventListener('visibilitychange', _webVisibilitychange);
}

void dispose() {
  super.dispose();
  html.document.removeEventListener('visibilitychange', _webVisibilitychange);
}

void _webVisibilitychange(html.Event event) {
  print(event);
  print(mounted);
}
terrier989 commented 3 years ago

Thanks for the report! In browser, it will use dart:html and behave correctly. Elsewhere it's not expected to work.