添加并导入位置包
并使用此代码打开位置
Location location = new Location();
bool ison = await location.serviceEnabled();
if (!ison) { //if defvice is off
bool isturnedon = await location.requestService();
if (isturnedon) {
print("GPS device is turned ON");
}else{
print("GPS Device is still OFF");
}
}