Skip to content
This repository has been archived by the owner on Jan 28, 2025. It is now read-only.

Not Working on VPN #20

Open
afzl-wtu opened this issue Jun 25, 2023 · 1 comment
Open

Not Working on VPN #20

afzl-wtu opened this issue Jun 25, 2023 · 1 comment

Comments

@afzl-wtu
Copy link

If Connected to a VPN connection or Ethernet connection .. The package fails to detect if internet exists.

@cmtboy
Copy link

cmtboy commented Dec 4, 2023

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants