isInternetAvailable static method
Implementation
static Future<bool> isInternetAvailable() async {
print("VERIFICANDO CONEXĂO COM A INTERNET...");
try {
final list = await InternetAddress.lookup('google.com');
if (list.isNotEmpty && list[0].rawAddress.isNotEmpty) {
print('CONNECTED!');
return true;
}
} on SocketException catch (_) {
print('NOT CONNECTED!');
return false;
}
return false;
}