hasInternet method
Implementation
Future<bool> hasInternet() {
return Future.any([
Future.delayed(kTimeOutDuration, () => false),
http
.get(pingUrl)
.then((final response) => response.statusCode == 200)
.catchError((_) => false),
]);
}