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
[connectivity_plus] "onConnectivityChanged" having troubles on receiving results #479
Comments
@theiskaa can I take up this task |
@loud-at-heart Sure thing. |
Sometime it happens. But the problem that I face is that when I turn on the wifi then the connectivity result is none and vice versa when I turn off the wifi, the connectivity result is wifi. Does that library work like this or this is a bug ? |
@theiskaa I think it would be nice if you post the code so everyone can reproduce this bug. |
Here it is: Codeclass MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool isConnected = true;
late StreamSubscription connectivityStream;
void setConnectivitySubscription() {
connectivityStream = Connectivity().onConnectivityChanged.listen(
(ConnectivityResult result) {
setState(() {
isConnected = (result != ConnectivityResult.none);
});
},
);
}
@override
void initState() {
super.initState();
setConnectivitySubscription();
}
@override
void dispose() {
connectivityStream.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(widget.title)),
body: Center(
child: Text(
isConnected ? 'Connected' : 'No connection',
style: Theme.of(context).textTheme.headline4,
),
),
);
}
}
|
This is a pretty old bug that only affects simulator. See ashleymills/Reachability.swift#151. I have tested both |
Absolutely agree, this should be noted in docs to avoid such confusions. |
Documentation has been updated. Do we need to keep this ticket open? |
Thanks @miquelbeltran , i think we can close an issue. |
I am having same issue, i test app on ios simulator and it shows ConnectivityResult.none even though my wifi is connected. |
Any updates? This issue is still happening. Thanks. |
Hi everyone, A bad thing for our customers. Any news about it? Thank you |
I am still getting the same issue, Has anyone found a solution? |
Temporary fix |
I have problems with listening to the connectivity state changing.
Steps to reproduce issue:
And I tried just printing the results. But also it wasn't receive the connectivity results.
Screen.Recording.2021-10-01.at.22.51.51.mov
The text was updated successfully, but these errors were encountered: