isInternetConnected function

Future<bool> isInternetConnected()

check wheather the device is connected to the internet or not.

retrun true if internet is available.

Implementation

Future<bool> isInternetConnected() async {
  try {
    Response response = await get(Uri.parse('https://telegram.org/'));
    return response.statusCode == 200;
  } catch (e) {
    return false;
  }
}