flutter_connectivity_widget icon indicating copy to clipboard operation
flutter_connectivity_widget copied to clipboard

Banner only works with provided url not googgle, facebook, amazon ect

Open liveaffiliates opened this issue 4 years ago • 2 comments

Hi,

Thanks for creating this.

I am trying to implement but have run into strange behavior with the following line:

ConnectivityUtils.instance.setServerToPing("https://gist.githubusercontent.com/Vanethos/dccc4b4605fc5c5aa4b9153dacc7391c/raw/355ccc0e06d0f84fdbdc83f5b8106065539d9781/gistfile1.txt");

It works great with the address you provided but if I comment out that line I thought it would default to www.google.com but I just get no connectivity.

If I change it to google, facebook, amazon all give no connectivity like so:

  ConnectivityUtils.instance.setServerToPing("http://www.google.com");
  ConnectivityUtils.instance.setServerToPing("http://www.facebook.com");
  ConnectivityUtils.instance.setServerToPing("http://www.amazon.com");

I am not sure why only your provided text file is working. I am currently staying in Indonesia, that's all I can think.

Is there any way for me to debug whats going on?

Thanks

liveaffiliates avatar Apr 26 '20 13:04 liveaffiliates

The new version will have #13 integreated, which will check for all the status codes between 200 and 399.

This might be due to the fact that some of the websites were returning 204, for example, and the library was not correctly handling them

If you can, please try with the new version (I'll upload it in a few hours)

Vanethos avatar May 17 '20 11:05 Vanethos

Using "http://example.com/" with a callback works for me as follow:

ConnectivityUtils.initialize( serverToPing: "http://example.com/", callback: (response) => response.isNotEmpty );

This works for me.

ebot64 avatar May 27 '20 14:05 ebot64