How to get autocomplete location of places in Flutter with Latitude and Longitude of tapped place?

In my app I want the user to type out a place(and flutter_google_places must show suggestions of places). Then I want to get the latitude and longitude of that place he taps.

Problem:I have seen this answer:How to create a simple google maps address search with autocomplete in flutter and get latitude and longitude?

which is similar to my question but it does not work for me!

final api_key=API_KEY;
GoogleMapsPlaces _places = GoogleMapsPlaces(apiKey: API_KEY);
LocationData user_location=LoginPage.LD;

Widget build(BuildContext context) {

   CameraPosition cuurent_location_of_user = CameraPosition(

   target: LatLng(user_location.latitude,user_location.longitude),
   zoom: 16,

return Scaffold(
  body: Stack(
    children: <Widget>[
        mapType: MapType.hybrid,
        initialCameraPosition: cuurent_location_of_user,
        onMapCreated: (GoogleMapController controller) {
          child: RaisedButton(
            onPressed: () async {

               Prediction p =  await
                  context: context, apiKey: api_key);



Future<Null> displayPrediction(Prediction p) async {
  if (p != null) {
    PlacesDetailsResponse detail =
    await _places.getDetailsByPlaceId(p.placeId);

  var placeId = p.placeId;
  double lat =;
  double lng = detail.result.geometry.location.lng;

  var address = await Geocoder.local.findAddressesFromQuery(p.description);


} ```

If I try to: print(p.toString()); It returns null I am unable to find the problem in my code I have also enabled the places API in Google Cloud Service and I have taken the most recent API_KEY as well

Thank You