connectivityCheck method

Future<bool> connectivityCheck()

Implementation

Future<bool> connectivityCheck() async {
  final List<ConnectivityResult> connectivityResult =
      await (Connectivity().checkConnectivity());

  var isConnect = false;

  if (connectivityResult.contains(ConnectivityResult.mobile)) {
    isConnect = true;
  } else if (connectivityResult.contains(ConnectivityResult.wifi)) {
    isConnect = true;
  } else if (connectivityResult.contains(ConnectivityResult.ethernet)) {
    isConnect = true;
  } else if (connectivityResult.contains(ConnectivityResult.vpn)) {
    isConnect = true;
  } else if (connectivityResult.contains(ConnectivityResult.bluetooth)) {
    isConnect = true;
  } else if (connectivityResult.contains(ConnectivityResult.other)) {
    isConnect = true;
  } else if (connectivityResult.contains(ConnectivityResult.none)) {
    isConnect = false;
  } else {
    isConnect = false;
  }

  return isConnect;
}