Skip to content

Commit dcd2ae2

Browse files
committed
Fix iOS location crash
1 parent f409c5f commit dcd2ae2

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

lib/parking_map_screen.dart

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,18 @@ class _ParkingMapScreenState extends State<ParkingMapScreen> {
7373
debugPrint("Error getting current position: $e");
7474
}
7575

76-
_positionStreamSubscription = Geolocator.getPositionStream().listen((
77-
position,
78-
) {
79-
if (mounted) {
80-
setState(() {
81-
_currentPosition = position;
82-
});
83-
}
84-
});
76+
_positionStreamSubscription = Geolocator.getPositionStream().listen(
77+
(position) {
78+
if (mounted) {
79+
setState(() {
80+
_currentPosition = position;
81+
});
82+
}
83+
},
84+
onError: (e) {
85+
debugPrint("Error receiving location update: $e");
86+
},
87+
);
8588
}
8689

8790
void _centerOnUser() {

0 commit comments

Comments
 (0)