A flutter plugin that decodes encoded google polyline string into list of geo-coordinates suitable for showing route/polyline on maps. We have improved the accuracy for polyline points which was previously breaking up on longer routes and used to go over the building without taking major turns.
Now – Updated
This package contains functions to decode google encoded polyline string which returns a list of co-ordinates indicating route between two geographical position
To use this package, add flutter_polyline_points as a dependency in your pubspec.yaml file.
Import the package
Get the list of points by Geo-coordinate, this return an instance of PolylineResult, which contains the status of the api, the errorMessage, and the list of decoded points.
PolylinePoints polylinePoints = PolylinePoints(); PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(googleAPiKey, _originLatitude, _originLongitude, _destLatitude, _destLongitude); print(result.points);
Decode an encoded google polyline string e.g _p
List<PointLatLng> result = polylinePoints.decodePolyline("_p~iF~ps|U_ulLnnqC_mqNvxq`@"); print(result);
See the example directory for a complete sample app
kindly ensure you use a valid google api key, If you need help generating api key for your project click this link