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

wayPoints error #29

Closed ismetatakli closed 3 years ago

ismetatakli commented 4 years ago

when i try to add waypoints i get an error.

_TypeError (type 'MappedListIterable<PolylineWayPoint, String>' is not a subtype of type 'List<String>')

Can you show me an example of adding coordinates at waypoints. the examples you have given do not work correctly

kawaldeep2507 commented 4 years ago

Change List wayPointsArray = wayPoints.map((point) => point.location.toString());

in network_util to this and it will work.

List wayPointsArray=[]; wayPoints.forEach((point) => wayPointsArray.add(point.location));

javico2609 commented 4 years ago

wayPoints.forEach((point) => wayPointsArray.add(point.location)).ToList();

rafay-tariq commented 4 years ago

received this same issue when adding the waypoints.

` code

 PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
    googleAPIKey,
    PointLatLng(31.4805, 74.3239),
    PointLatLng(31.4697, 74.2728),
    travelMode: TravelMode.driving,
    wayPoints: [PolylineWayPoint(location: "Sabo, Yaba Lagos Nigeria")]
    );`
rafay-tariq commented 4 years ago

yes when i update this above line that you have provided this error goes out but now it added the waypoints in the API as

https://maps.googleapis.com/maps/api/directions/json?origin=31.4805%2C74.3239&destination=31.4697%2C74.2728&mode=driving&avoidHighways=false&avoidFerries=true&avoidTolls=false&key=YOUR_API_KEY&waypoints=faisalabad

BUT it should pass it as &waypoints=via:faisalabad even i pass the bool value as false

wayPoints: [PolylineWayPoint(location: "faisalabad", stopOver: false)],

adanluna commented 3 years ago

I had the same error and I fixed with @kawaldeep2507 solution, thanks man!

Dammyololade commented 3 years ago

The next release in couple of hours will resolve this