checkLocationService method
Implementation
Future<bool> checkLocationService() async {
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled) {
showAlertDialog(
title: '请打开定位服务以获取您的位置信息',
cancelText: '取消',
confirmText: '去设置',
onConfirm: () async {
if (await Geolocator.openLocationSettings()) {
// 用户已打开定位设置页面
// BZLoading.toast('定位服务已开启,请刷新');
} else {
// 用户未打开定位设置页面
// BZLoading.toast('未打开定位服务');
}
Get.back();
});
}
return serviceEnabled;
}