Dammyololade / flutter_polyline_points

A flutter plugin that's decodes encoded google poly line string into list of geo-coordinates suitable for showing route/polyline on maps
MIT License
105 stars 130 forks source link

XMLHttpRequest Error #78

Closed sureshvickey closed 1 year ago

sureshvickey commented 1 year ago

getroutebetweencoordinates from flutter web creates XMLHttpRequest Error.

vasuravada commented 1 year ago

Me also getting the same error, any work around for this?

Dammyololade commented 1 year ago

Now available on version 2.0.0

wendellavila commented 1 year ago

I'm still experiencing this on 2.0.0. It only works when running with --web-browser-flag "--disable-web-security".

wendellavila commented 1 year ago

I found the cause for the error. To make a request to Google Maps from a browser you must use the Javascript API. The Directions API doesn't support CORS and will return an XMLHttpRequest error when called from the client-side.

For now I made a workaround that uses the google_maps package to get the points and then uses the flutter_polyline_points decoder to generate LatLng coordinates.