checkLocation method

dynamic checkLocation({
  1. bool? notCallApi,
})

Implementation

checkLocation({bool? notCallApi}) {
  Helper().determinePosition().then((value) async {
    if (value != null) {
      latitude = value.latitude;
      longitude = value.longitude;
      if (!onCallApi) {
        if (!suscessDaftar) {
          apiRegister();
        }
      }
      // getLocationFromlatlong("${value.latitude},${value.longitude}",
      //     isNotCallApi: notCallApi);
    } else {
      Helper().modalSellOn(contextnya,
          barierDismisable: false,
          message: "Turn on your GPS location",
          alone: true, onOke: () async {
            if (Platform.isAndroid) {
              const AndroidIntent intent = AndroidIntent(
                action: 'action_location_source_settings',
              );

              Navigator.pop(contextnya);
              // isHaveUDIDglobal = isHaveUDID;
              checkingLocationServise = true;
              setState(() {
                Future.delayed(Duration(seconds: 1)).then((value) async {
                  intent.launch();
                });
              });
            } else {
              AppSettings().openLocation().then((value) {
                Navigator.pop(contextnya);
                // isHaveUDIDglobal = isHaveUDID;
                checkingLocationServise = true;
                setState(() {});
                // Future.delayed(Duration(seconds: 1)).then((value) {
                //   _determinePosition(isHaveUDID: isHaveUDID).then((value) {
                //     if(value != null){
                //       checkLocationUser(value,isDouble: isHaveUDID);
                //     }
                //   });
                // });
              });
            }
          });
      // idCover = Config.wilayahLocalID.id;
      // checkBeforeRegister();
    }
  }).catchError((s) {
    // idCover = Config.wilayahLocalID.id;
    // checkBeforeRegister();
  }).onError((error, stackTrace) {
    // idCover = Config.wilayahLocalID.id;
    // checkBeforeRegister();
  });
}