wow_shopping icon indicating copy to clipboard operation
wow_shopping copied to clipboard

connection_monitor - iOS Simulator - onConnectivityChanged not showing Wifi going off

Open JediPixels opened this issue 1 year ago • 0 comments

This is only happening in iOS Simulator. But when you turn off the WiFi onConnectivityChanged still shows WiFifi is turned on instead of off.

  1. Run the App with WiFi turned on
  2. Turn off the WiFi on Mac
  3. onConnectivityChanged still shows 'wifi' instead of 'none' for internet connection

I have tested with my own projects and the onConnectivityChanged is behaving the same way, I believe the issue is with the connectivity_plus plugin.

But if you do the following it works ok but will break again

  1. Run the App with WiFi turned off
  2. Turn on the WiFi on Mac (it works)
  3. Turn off the WifFi on Mac
  4. onConnectivityChanged still shows 'wifi' instead of 'none' for internet connection

my testing code:

connectionService.connectivity.onConnectivityChanged
    .listen((connectivityResult) {
  debugPrint('connectivityResult: ${connectivityResult.name}');
});
return StreamBuilder(
          initialData: snapshot.requireData,
          stream: onConnectivityChanged,
          builder: (BuildContext context, AsyncSnapshot<ConnectivityResult> snapshot) {
            final result = snapshot.requireData;
            return _ConnectivityBannerHost(
              isConnected: result != ConnectivityResult.none,

It returns ConnectivityResult..wifi instead of .none

By the way, when you run it on an actual iPhone device it looks like its working fine.

Thanks

JediPixels avatar Aug 14 '23 20:08 JediPixels