isReachable static method
Checks if given site is reachable
Implementation
static Future<bool> isReachable(String site) async {
bool isAvailable = false;
try {
final result = await InternetAddress.lookup(site);
isAvailable = result.isNotEmpty && result[0].rawAddress.isNotEmpty;
} on SocketException catch (_) {
isAvailable = false;
}
TGLog.d(
"TGNetUtil.isReachable('" + site + "') = " + isAvailable.toString());
return isAvailable;
}