Open
Description
Future<bool> _ping() async {
try {
final results = await Ping(ipAddress, count: 4).stream.toList();
if (results.isEmpty) {
return false;
}
final summary = results.last.summary!;
final successRate = summary.received / summary.transmitted;
return successRate > 0.5;
} catch (e) {
return false;
}
}
The code above always return immediately, doesn't matter if I set the count
to 4 or 40. The result
is always empty and immediate.
I'm using an Android 11 and the ipAddress
is from an iot device (without internet) that I'm connected to.
Also, when using emulated terminals I get "Network is unreachable", but my app can properly communicate with the device.