Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prediction lat lang is null #38

Open
niikocap opened this issue Dec 13, 2023 · 8 comments
Open

Prediction lat lang is null #38

niikocap opened this issue Dec 13, 2023 · 8 comments

Comments

@niikocap
Copy link

When i type some keyword suggestion pops but when i click lat lng is always null
description has value

@shruti-techindustan
Copy link
Contributor

shruti-techindustan commented Dec 13, 2023

@niikocap
can you please share your code here

@niikocap
Copy link
Author

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

@niikocap
Copy link
Author

i got one more question can you assign function for cross button ?

@shruti-techindustan
Copy link
Contributor

sure @niikocap

@shruti-techindustan
Copy link
Contributor

@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?

@vivektopiya
Copy link

@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!

@ShaunAtSense
Copy link

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();
  }
},

@ankush335
Copy link

When i type some keyword suggestion pops but when i click lat lng is always null description has value

hii
help me to find lat lng value
also my values are null
solution pls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants