locationPermission static method

Future<bool> locationPermission()

定位权限

Implementation

static Future<bool> locationPermission() async {
  if (await Permission.location.status.isDenied) {
    if (await Permission.location.status.isPermanentlyDenied) {
      return openAppSettings();
    }
    var request = await Permission.location.request();
    if (request.isDenied) {
      return request.isGranted;
    }
  }
  return true;
}