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
304 stars 415 forks source link

Flutter Web: Facing Error: FormatException: SyntaxError #118

Closed rguntha closed 2 years ago

rguntha commented 4 years ago

I am running into the below stack trace when I click on the place prediction.

It is failing at the below line

PlacesDetailsResponse detail = await _places.getDetailsByPlaceId(p.placeId)

I am using the 0.2.5 (latest version) of the flutter_google_places package.

Below the stack-trace.

errors.dart:167 Uncaught (in promise) Error: FormatException: SyntaxError: Unexpected token T in JSON at position 0 at Object.throw_ [as throw] (errors.dart:216) at Object._parseJson (convert_patch.dart:41) at JsonDecoder.convert (json.dart:505) at JsonCodec.decode (json.dart:153) at places.GoogleMapsPlaces.new.[_decodeDetailsResponse] (places.dart:366) at places.GoogleMapsPlaces.new.getDetailsByPlaceId (places.dart:115) at getDetailsByPlaceId.next () at onValue (async_patch.dart:47) at _RootZone.runUnary (zone.dart:1439) at _FutureListener.thenAwait.handleValue (future_impl.dart:141) at handleValueCallback (future_impl.dart:686) at Function._propagateToListeners (future_impl.dart:715) at _Future.new.[_completeWithValue] (future_impl.dart:526) at async._AsyncCallbackEntry.new.callback (future_impl.dart:560) at Object._microtaskLoop (schedule_microtask.dart:43) at _startMicrotaskLoop (schedule_microtask.dart:52) at async_patch.dart:168

tayseer9 commented 3 years ago

Try to change your port & hostname as follow:

flutter run -d web-server --web-port 8080 --web-hostname 0.0.0.0

then access http://:8080

also you should ensure that your port(8080) is open.

juliansteenbakker commented 2 years ago

I have updated this package, please use the following:

  flutter_google_places:
    git:
      url: https://github.com/fluttercommunity/flutter_google_places
      ref: v0.3.2
urvashi-k-7span commented 2 years ago

Can you please tell me what did you change exactly? @juliansteenbakker