Flutter app that uses google_maps_flutter: ^2.0.6, location: ^4.3.0 and permission_handler: ^8.1.4+2 produces iOS error in the title on the next launch or lock/unlock screen, when location permissions is denied or set to never.
Permission is asked not on the first screen but on the third. But error keep showing event on start up.
This is how location permission is asked
Future<void> _initGeolocation() async {
bool serviceEnabled;
serviceEnabled = await _location.serviceEnabled();
if (!serviceEnabled) {
return;
}
_permissionGranted = await _location.hasPermission();
if (_permissionGranted == PermissionStatus.denied ||
_permissionGranted == PermissionStatus.deniedForever) {
if (Platform.isAndroid) {
await _showLocationInfoPopup();
} else {
await _showLocationSettingsPopup();
}
_permissionGranted = await _location.requestPermission();
if (_permissionGranted != PermissionStatus.granted) {
return;
}
}
final coordinates = await _location.getLocation();
if (coordinates != null) {
_initialUserPosition =
LatLng(coordinates.latitude, coordinates.longitude);
}
_userPositionSubscription = _location.onLocationChanged
.listen((event) => _updateUserLocation(event));
return;
}
This is Info.plist
<key>NSLocationWhenInUseUsageDescription</key>
<string>1</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>1</string>
This is Podfile
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=1',