Flutter Geolocator 5.0.1 not working properly
I'm having a problem with the flutter geolocator: ^5.0.1 dependencies. Bt it doesn't show the location also not showing any error. I have given permission in the manifest file also.
I'm using flutter stable version 1.22.6 and for this project compile SDK version is 29.
Manifest file:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />`
Flutter Code for getting location:
String specificAddress;
try {
Position position = await Geolocator()
.getCurrentPosition(
desiredAccuracy: LocationAccuracy.best);
List<Placemark> placeMarks = await Geolocator()
.placemarkFromCoordinates(
position.latitude, position.longitude);
Placemark mPlaceMark = placeMarks[0];
// String completeAddressInfo =
// "${mPlaceMark.subThoroughfare} ${mPlaceMark.thoroughfare}, " +
// "${mPlaceMark.subLocality} ${mPlaceMark.locality}, " +
// "${mPlaceMark.subAdministrativeArea} ${mPlaceMark.administrativeArea}, " +
// "${mPlaceMark.postalCode} ${mPlaceMark.country}, ";
specificAddress =
"${mPlaceMark.subLocality}, ${mPlaceMark.locality}, ${mPlaceMark.country}";
locationTextEditingController.text = specificAddress;
setState(() {
_location = specificAddress;
});
} catch (e) {
_showSnackbar(e.toString());
}`
Error > when I press the "get my location button" it shows nothing....
What can I try to resolve this?
from Recent Questions - Stack Overflow https://ift.tt/3bEh1KY
https://ift.tt/3qRn5Gp
Comments
Post a Comment