connectivity_wrapper
connectivity_wrapper copied to clipboard
Not Working on VPN
If Connected to a VPN connection or Ethernet connection .. The package fails to detect if internet exists.
I resolved this issue by utilizing the vpn_connection_detector package. I monitored the VPN connection stream in the following way:
vpnDetector.vpnConnectionStream.listen((state) {
if (state == VpnConnectionState.connected) {
setState(() {
vpnConnected = true;
print("VPN connected");
});
} else {
setState(() {
vpnConnected = false;
print("VPN disconnected");
});
}
});
Afterward, I displayed or hide the widget based on the connection status:
return ConnectivityWidgetWrapper(
disableInteraction: vpnConnected ? false : true,
height: vpnConnected ? 0 : 80,
child: widget!,
);
This might not be the most ideal practice, it helped me get the job done.