Open pallavbohara opened 4 years ago
Hi there,
In my experience there won't be much difference. what exactly are you struggling with setting up for both?
Hello, Thanks for quick reply. Actually right now I am using connectivity: ^0.4.9+2 and it is returning "ConnectivityStatus.Offline" every time for web(which is I think wrong). And I think if we can check some where if it is web then just avoid connectivity check as web always will have connectivity.
@pallavbohara sounds like an option. the constant kIsWeb tells you if it's running on web or not. You can use that for your logic.
Hello, It is not working. I am trying like this(In reference to your 'NetWork Aware Code' in connectivity_servie.dart :
ConnectivityStatus _getStatusFromResult(ConnectivityResult result) { if (kIsWeb) { return ConnectivityStatus.Cellular; } switch (result) { case ConnectivityResult.mobile: return ConnectivityStatus.Cellular; break; case ConnectivityResult.wifi: return ConnectivityStatus.Wifi; break; case ConnectivityResult.none: return ConnectivityStatus.Offline; break; default: return ConnectivityStatus.Offline; } }
But It is always picking Offline code. I am attacing whole project zip in case you need.
Hello, It is not working. I am trying like this(In reference to your 'NetWork Aware Code' in connectivity_servie.dart :
ConnectivityStatus _getStatusFromResult(ConnectivityResult result) { if (kIsWeb) { return ConnectivityStatus.Cellular; } switch (result) { case ConnectivityResult.mobile: return ConnectivityStatus.Cellular; break; case ConnectivityResult.wifi: return ConnectivityStatus.Wifi; break; case ConnectivityResult.none: return ConnectivityStatus.Offline; break; default: return ConnectivityStatus.Offline; } }
But It is always picking Offline code. I am attacing whole project zip in case you need.
Sorry, I have mistakenly created a new issue.
That's the constant I used, maybe if changed. there's other ways to check for web as well. I don't have it on hand right now.
Hello FilledStacks Team, I really love your tutorials. While following tutorial for network connectivity I found that connectivity plugin is not returning correct values for web I also tried to add connectivity_for_web. Although web is offline always. But I cannot setup for both in single code base. Please guide to do so.
Regards, Pallav Bohara