How to check if connected wi-fi network has internet in the flutter app, when I use connectivityResult == ConnectivityResult.wifi
from connectivity 3.0.6 package, it returns true, but the upcoming functionalities won't work if I disabled the wi-fi data connection.
You can check the connection to a web page to make sure you have an internet connection, something like this :
checkConnection() async {
try {
final result = await InternetAddress.lookup('google.com');
if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
setState(() {
con = true;
});
}
} on SocketException catch (_) {
setState(() {
con = false;
});
}
}
that's work for me good luck.