checkConnectivity method

void checkConnectivity()

Implementation

void checkConnectivity() async {
  print("this is state ${state}");

  try {
    state.listen((event) {
      print("ths is stream event $event");
      if (event) {
        print("internet connected...");
        internetConnectivityCallBack?.call("Connected");
        reConnectSocketConnectTimer();
      } else {
        print("no internet...");
        internetConnectivityCallBack?.call("Disconnected");
        closeSocket();
      }
    }, cancelOnError: true);
  } catch (e) {
    bool internetState = await getInternetStatus();
    if (internetState) {
      reConnectSocketConnectTimer();
    }
  }
}