Development Solutions/Flutter & Dart

How to solve error "unhandled exception: user denied permissions to access the device's location." 해결방법

studio ODOC 2022. 10. 19. 20:37
반응형

How to solve error

"unhandled exception: user denied permissions to access the device's location."

해결방법

 

 

아래와 같이 오류 메시지 발생 (Error message as below)

unhandled exception: user denied permissions to access the device's location.

 

해결 방법 : 아래 코드와 같이 permission을 추가하는 코드 작성 (Solution: Write code to add permission like below code)

LocationPermission permission = await Geolocator.requestPermission(); // 추가!!
Position position = await Geolocator.getCurrentPosition();
반응형