-
-
Notifications
You must be signed in to change notification settings - Fork 983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: onConnectivityChanged callback not invoked when changing wifi network via settings (app is backgrounded) #3248
Comments
I am not sure if I understand the issue, is this what you are seeing?
I don't think the issue is the I'd recommend you to use the normal get connectivity method in addition to the |
Removing the distinct application on the stream resolves the issue in my testing of this scenario (tested by editing local pub cached version). |
Yes, you already mention the problem with relying on a stream, even without the My advice remains the same, don't rely on a stream that doesn't work as expected (even without Anyway, we decided to add |
I agree, I'm not receiving the connectivity status change to
That's fair.
Understood, and would appreciate if you further considered adding |
Platform
iOS v17.5.1
Plugin
connectivity_plus
Version
6.0.3+
Flutter SDK
3.19.1
Steps to reproduce
I've edited the pub cached version of the plugin during testing and the issue appears to have been introduced via the connectivity_plus.dart implementation change:
Stream<List> get onConnectivityChanged {
return _platform.onConnectivityChanged.distinct((a,b) => a.equals(b));
}
[MERGE] (https://github.com/fluttercommunity/plus_plugins/pull/2836/files)
In my investigation I noticed upon the app starting, the value of the list of connectivityResults is ConnectivityResult.wifi.
When changing the wifi network in the background, upon resuming the app the list of results again is reported as ConnectivityResult.wifi and is being filtered by the addition of the distinct operation on the stream. The act of changing the network in the background seems to omit the reporting of ConnectivityResult.none, which in turn, results in the omission of the following ConnectivityResult.wifi event coming across the stream for the wifi network change as the contents of the list have not changed.
NOTE 1: The issue is only reproducible on the release build of the app (not debug or profile mode).
NOTE 2: The issue does not occur if using the "Control Center" wifi selector. In this case, leave the app in the foreground but swipe from the upper right hand corner to open the control center...
NOTE 3: Reproduced on a physical device, not a simulator
Code Sample
Logs
Flutter Doctor
Checklist before submitting a bug
flutter pub upgrade
flutter clean
The text was updated successfully, but these errors were encountered: