getConnectivity method

void getConnectivity(
  1. BuildContext context
)

Implementation

void getConnectivity(BuildContext context) {
  subscription = Connectivity().onConnectivityChanged.listen(
    (ConnectivityResult result) async {
      print("connect");
      isDeviceConnected = await InternetConnectionChecker().hasConnection;
      print(isDeviceConnected);
      if (!isDeviceConnected) {
        handleOffline();
      } else {
        processOfflineEvents();
      }
    },
  );
}