Open
Description
I have a plugin/app that attaches a listener to the window.navigator.connection.onChange
Stream.
However, when the app/plugin hot restarts, I don't have any opportunity of canceling my old listener before attaching again.
Since connection.onChange
is a DOM global, I end up with callbacks firing multiple times (+1 after each hot reload).
Is there any way I can detect a Hot Restart from app/plugin code before it happens, so I can dispose of the resources I've taken?
See also: flutter/flutter#10437
(I have worked around this issue by writing directly to the onchange
property of the underlying DOM object, but that is not "polite")
- SDK Version:
2.9.0-21.0.dev.flutter-06cb010247 (be) (Tue Jul 7 08:14:51 2020 +0000) on "linux_x64"
- OS: Linux (doesn't matter)
- Browser: Chrome (doesn't matter)