-
Notifications
You must be signed in to change notification settings - Fork 396
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
App crashes when search prediction is clicked #69
Comments
Code Implementation class _SearchBarState extends State<SearchBar> {
GoogleMapsPlaces _places = GoogleMapsPlaces(apiKey: apiKey);
@override
Widget build(BuildContext context) {
return FloatingActionButton(
mini: true,
heroTag: "ssearch",
onPressed: () async {
Prediction p =
await PlacesAutocomplete.show(context: context, apiKey: apiKey, mode: Mode.overlay);
displayPrediction(p);
},
child: Icon(Icons.search),
);
}
Future<Null> displayPrediction(Prediction p) async {
if (p != null) {
PlacesDetailsResponse detail =
await _places.getDetailsByPlaceId(p.placeId);
var placeId = p.placeId;
double lat = detail.result.geometry.location.lat;
double lng = detail.result.geometry.location.lng;
var address = await Geocoder.local.findAddressesFromQuery(p.description);
print(lat);
print(lng);
}
}
} |
@pratik037 you can use this method |
I had the same issue. Thanks @ma3az33, it works! |
Okay, so we can close this issue now. |
It Works for me....!!!! |
When the any of the prediction is clicked, the app crashes and the debug stops automatically.
Device: Redmi Note 4
Flutter version: 1.6.3
The text was updated successfully, but these errors were encountered: