kInternetCheck function

Future<bool> kInternetCheck()

check internet

Implementation

Future<bool> kInternetCheck() async {
  try {
    final result = await InternetAddress.lookup('google.com');
    if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
      return true;
    }
    return false;
  } on Exception catch (_) {
    return false;
  }
}