checkConnectivity static method
THIS SERVICE IS TO CHECk CONNECTION AND RETURN TRUE OR FALSE depending on the connection
Implementation
static Future<bool> checkConnectivity() async {
try {
final result = await InternetAddress.lookup('google.com');
if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
_isConnected = true;
}
} on SocketException catch (_) {
_isConnected = false;
}
return _isConnected;
}