locationpicker
locationpicker copied to clipboard
LocationResult return null
result = await Navigator.of(context).push(MaterialPageRoute( builder: (context) => PlacePicker(keyMap, displayLocation: LatLng(lat,lon), )));
print(result);
Same for me.
This library practically doesnt work and is neither useful for any reasonable use
I was getting the same result until I did some debugging - turns out you have to enable billing in the project for Places Api to work. After setting up billing and link it to the project it works perfectly.
Here are the details: Error while debugging:
0 = {map entry} "error_message" -> "You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/bi..."
1 = {map entry} "predictions" -> [_GrowableList]
2 = {map entry} "status" -> "REQUEST_DENIED"
You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
Geocoding API needs to be enabled for the plugin to work and return actual place info (and not null), whereas the Places API is optional and needed only if you want to display "Places" such as restaurants etc.
Geocoding API: https://console.cloud.google.com/apis/library/geocoding-backend.googleapis.com