checkInternet function
Instant check internet connection by providing the lookup address default is google.com
Implementation
Future<bool> checkInternet({lookupAddress = "google.com"}) async {
bool internet = false;
try {
final result = await InternetAddress.lookup(lookupAddress);
if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
internet = true;
}
} on SocketException catch (_) {
internet = false;
}
return internet;
}