checkNetWork method

Future<bool> checkNetWork([
  1. Function? callBack
])

Implementation

Future<bool> checkNetWork([Function? callBack]) {
  Future<bool> isOk = isConnected();
  isOk.then((value) {
    if (!value) {
      Alert.showAlert('网络错误,请检查当前网络', callBack: () {
        if (Get.currentRoute != Routes.login) {
          // Get.offNamedUntil(Routes.login, (route) => false);
        }
        callBack?.call();
      });
      return;
    }
  });
  return isOk;
}