hardReset static method
Forcefully reset everything (useful for Flutter Web hot restart).
Cancels the stream subscription, drops callbacks, and recreates the ValueNotifier to detach any stale listeners.
Implementation
static Future<void> hardReset() async {
_generation++;
_isDisposed = true;
_lastEmitted = null;
_onConnectedCallback = null;
_onDisconnectedCallback = null;
await _onConnectivityChangedSubs?.cancel();
_onConnectivityChangedSubs = null;
final previous = _connectionNotifier;
final initialValue = previous.value;
_connectionNotifier = ValueNotifier<bool>(initialValue);
try {
previous.dispose();
} catch (_) {}
}