File tree 2 files changed +16
-18
lines changed
2 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -128,23 +128,22 @@ Future<Position> _determinePosition() async {
128
128
129
129
permission = await Geolocator.checkPermission();
130
130
if (permission == LocationPermission.denied) {
131
- permission = await Geolocator.requestPermission();
132
- if (permission == LocationPermission.deniedForever) {
133
- // Permissions are denied forever, handle appropriately.
134
- return Future.error(
135
- 'Location permissions are permanently denied, we cannot request permissions.');
136
- }
137
-
131
+ permission = await Geolocator.requestPermission();
138
132
if (permission == LocationPermission.denied) {
139
133
// Permissions are denied, next time you could try
140
134
// requesting permissions again (this is also where
141
135
// Android's shouldShowRequestPermissionRationale
142
136
// returned true. According to Android guidelines
143
137
// your App should show an explanatory UI now.
144
- return Future.error(
145
- 'Location permissions are denied');
138
+ return Future.error('Location permissions are denied');
146
139
}
147
140
}
141
+
142
+ if (permission == LocationPermission.deniedForever) {
143
+ // Permissions are denied forever, handle appropriately.
144
+ return Future.error(
145
+ 'Location permissions are permanently denied, we cannot request permissions.');
146
+ }
148
147
149
148
// When we reach here, permissions are granted and we can
150
149
// continue accessing the position of the device.
Original file line number Diff line number Diff line change @@ -128,23 +128,22 @@ Future<Position> _determinePosition() async {
128
128
129
129
permission = await Geolocator.checkPermission();
130
130
if (permission == LocationPermission.denied) {
131
- permission = await Geolocator.requestPermission();
132
- if (permission == LocationPermission.deniedForever) {
133
- // Permissions are denied forever, handle appropriately.
134
- return Future.error(
135
- 'Location permissions are permanently denied, we cannot request permissions.');
136
- }
137
-
131
+ permission = await Geolocator.requestPermission();
138
132
if (permission == LocationPermission.denied) {
139
133
// Permissions are denied, next time you could try
140
134
// requesting permissions again (this is also where
141
135
// Android's shouldShowRequestPermissionRationale
142
136
// returned true. According to Android guidelines
143
137
// your App should show an explanatory UI now.
144
- return Future.error(
145
- 'Location permissions are denied');
138
+ return Future.error('Location permissions are denied');
146
139
}
147
140
}
141
+
142
+ if (permission == LocationPermission.deniedForever) {
143
+ // Permissions are denied forever, handle appropriately.
144
+ return Future.error(
145
+ 'Location permissions are permanently denied, we cannot request permissions.');
146
+ }
148
147
149
148
// When we reach here, permissions are granted and we can
150
149
// continue accessing the position of the device.
You can’t perform that action at this time.
0 commit comments