matanshukry / flutter_google_places_sdk

Flutter plugin for google places native sdk
36 stars 74 forks source link

FlutterGooglePlacesSdk::call error: UnimplementedError: initialize() has not been implemented. #60

Closed huesmiles49 closed 1 year ago

huesmiles49 commented 1 year ago

This is my current code: final FlutterGooglePlacesSdk _places = FlutterGooglePlacesSdk(FlavorConfig().googlePlacesApiKey);


 FindAutocompletePredictionsResponse res =
        await _places.findAutocompletePredictions(_searchText);
    print(res);
    setState(() {
      _predictions = res.predictions;
    });```

When I type a text in the TextField to request the predictions, the package is returning this error: 
`FlutterGooglePlacesSdk::call error: UnimplementedError: initialize() has not been implemented.`
huesmiles49 commented 1 year ago

My other attempt to initialize the package doesn't work either. Code:

final places = FlutterGooglePlacesSdk.platform;
    places.initialize(FlavorConfig().googlePlacesApiKey);
    FindAutocompletePredictionsResponse res =
        await places.findAutocompletePredictions(_searchText);
    setState(() {
      _predictions = res.predictions;
    });
Screenshot 2023-09-26 at 4 31 39 PM
matanshukry commented 1 year ago

@huesmiles49 Looks like something is wrong with the dependencies. Take a look at the example in this project and use it.

If you still have issue, please create a small reproducible example that we can work.

huesmiles49 commented 1 year ago

System: Mac - Ventura 13.0.1 Flutter Version: 3.13.0 Platform: Flutter web

I'm unable to reproduce the issue. It seem to happen randomly. This is the first time I'd experience the issue directly. Another time was when the same problem happen to my coworker. So far, we've only seen this issue on Flutter web.

The only way I know to fix this problem is:

To conclude, I applied the fix mentioned and the package is working again.

matanshukry commented 1 year ago

@huesmiles49 it sounds like flutter dependencies/caching issues.

But either way glad to hear it's working again!