fluttercommunity / flutter_google_places

Google Places - Google places autocomplete widgets for flutter. No wrapper, use https://pub.dev/packages/google_maps_webservice. Maintainer: @juliansteenbakker
https://pub.dev/packages/flutter_google_places
Other
305 stars 422 forks source link

Example to use this package for flutter web #120

Closed bytejutsu closed 2 years ago

bytejutsu commented 4 years ago

I need an example on how to use this package on flutter for web to know how to include the google places API correctly. The package for web is showing me no search results for the moment.

KevMorelli commented 4 years ago

Check Issue 93 that explains what problems there are with web and some temporary solutions

angwandi commented 4 years ago

Any better solution coming sometime soon? @KevMorelli

suhmeanhuck commented 3 years ago

I saw that flutter_google_places states that it is compatible with flutter web but I just wanted to check if it only works with the workaround above?

Trying to search for "che" shows no results and throws the error:

[flutter_google_places_hoc081098] headers={} [flutter_google_places_hoc081098] input=ch location=null origin=null [flutter_google_places_hoc081098] ERROR XMLHttpRequest error. dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 906:28 get current packages/http/src/browser_client.dart 71:22 dart-sdk/lib/async/zone.dart 1612:54 runUnary dart-sdk/lib/async/future_impl.dart 152:18 handleValue dart-sdk/lib/async/future_impl.dart 704:44 handleValueCallback dart-sdk/lib/async/future_impl.dart 733:13 _propagateToListeners dart-sdk/lib/async/future_impl.dart 530:7 [_complete] dart-sdk/lib/async/stream_pipe.dart 61:11 _cancelAndValue dart-sdk/lib/async/stream.dart 1219:7 dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14 _checkAndCall dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39 dcall dart-sdk/lib/html/dart2js/html_dart2js.dart 37307:58

This post advised, "In most cases of Flutter API use, add Access-Control-Allow-Origin value in header might resolve the issue," but I don't think that is possible for the "apiHeaders" parameter.

Is it advised to avoid using this package for production on web at this time due to it only working with the workaround?

juliansteenbakker commented 2 years ago

Duplicate of #93, for now web is not supported.