Open niikocap opened 7 months ago
@niikocap can you please share your code here
i just copy paste the example, it seems work i save the lat lng getPlaceDetailWithLatLng from this then use that the item click doesnt work on me since it doesnt give correct data from prediction
i got one more question can you assign function for cross button ?
sure @niikocap
@niikocap
When you click on list item then under itemClick () ->
you will get Prediction object. From prediction object get place_id
from this object.
please request https://maps.googleapis.com/maps/api/place/details/json?placeid=placeId&key=googleAPIKey
this API to check whether latlng is getting or not?
@niikocap Please delete the part isLatLngRequired: false
from your code. After making this change, you should be able to obtain the latitude and longitude in the getPlaceDetailWithLatLng
function. I hope this clarification is helpful!
The itemBuilder returns the event prior to calling getPlaceDetailWithLatLng. Also, getPlaceDetailWithLatLng returns a Future which is not awaited on the onTap event. As a result, your Lat & Lng will return nulls.
@shruti-techindustan @Shrutimahajan If you update the onTap event on the itemBuilder as per below, then you will receive a Lat & Lng for your selected prediction.
onTap: () async {
var selectedData = alPredictions[index];
if (index < alPredictions.length) {
if (widget.isLatLngRequired) {
await getPlaceDetailsFromPlaceId(selectedData);
}
widget.itemClick!(selectedData);
removeOverlay();
}
},
When i type some keyword suggestion pops but when i click lat lng is always null description has value