checkNetworkConnection method

Future<bool> checkNetworkConnection()

Implementation

Future<bool> checkNetworkConnection() async {
  try {
    List<InternetAddress> result = await InternetAddress.lookup('google.com');
    if (result.isNotEmpty && result.first.rawAddress.isNotEmpty) return true;
  } on SocketException {
    return false;
  }
  return false;
}